|
| 1 | +name: Pull Request or Push to master |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: {} |
| 5 | + push: |
| 6 | + branches: [master] |
| 7 | + workflow_dispatch: {} |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.head_ref || github.run_id }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +permissions: {} |
| 14 | + |
| 15 | +jobs: |
| 16 | + trunk_check: |
| 17 | + name: Trunk Check |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + checks: write # For Trunk to post annotations |
| 21 | + contents: read |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 25 | + - name: Trunk Check |
| 26 | + uses: trunk-io/trunk-action@b61eb5749343e65e59ef104575a328b59f7285df # v1.1.4 |
| 27 | + |
| 28 | + detect_changes: |
| 29 | + name: Detect Changes |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + outputs: |
| 34 | + go: ${{ steps.filter.outputs.go }} |
| 35 | + python: ${{ steps.filter.outputs.python }} |
| 36 | + rust: ${{ steps.filter.outputs.rust }} |
| 37 | + typescript: ${{ steps.filter.outputs.typescript }} |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 41 | + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 |
| 42 | + id: filter |
| 43 | + with: |
| 44 | + filters: | |
| 45 | + go: |
| 46 | + - 'go/**' |
| 47 | + python: |
| 48 | + - 'python/**' |
| 49 | + rust: |
| 50 | + - 'rust/**' |
| 51 | + typescript: |
| 52 | + - 'typescript/**' |
| 53 | +
|
| 54 | + go_build_check: |
| 55 | + name: Go Build Check |
| 56 | + needs: detect_changes |
| 57 | + if: ${{ needs.detect_changes.outputs.go == 'true' }} |
| 58 | + runs-on: ubuntu-latest |
| 59 | + permissions: |
| 60 | + contents: read |
| 61 | + defaults: |
| 62 | + run: |
| 63 | + working-directory: go |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 67 | + - name: Setup Go |
| 68 | + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 |
| 69 | + with: |
| 70 | + go-version: 1.20.5 |
| 71 | + - name: Run build check |
| 72 | + run: go build -o bin/ src/main.go |
| 73 | + - name: Run execution check |
| 74 | + run: go run src/main.go |
| 75 | + timeout-minutes: 1 |
| 76 | + |
| 77 | + python_build_check: |
| 78 | + name: Python Build Check |
| 79 | + needs: detect_changes |
| 80 | + if: ${{ needs.detect_changes.outputs.python == 'true' }} |
| 81 | + runs-on: ubuntu-latest |
| 82 | + permissions: |
| 83 | + contents: read |
| 84 | + defaults: |
| 85 | + run: |
| 86 | + working-directory: python |
| 87 | + steps: |
| 88 | + - name: Checkout |
| 89 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 90 | + - name: Setup Python |
| 91 | + uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1 |
| 92 | + with: |
| 93 | + python-version: 3.11.4 |
| 94 | + - name: Setup Poetry |
| 95 | + uses: abatilo/actions-poetry@192395c0d10c082a7c62294ab5d9a9de40e48974 # v2.3.0 |
| 96 | + with: |
| 97 | + poetry-version: 1.5.1 |
| 98 | + - name: Install package dependencies |
| 99 | + run: poetry install |
| 100 | + - name: Run build check |
| 101 | + run: poetry build |
| 102 | + - name: Run execution check |
| 103 | + run: poetry run python src/main.py |
| 104 | + timeout-minutes: 1 |
| 105 | + |
| 106 | + rust_build_check: |
| 107 | + name: Rust Build Check |
| 108 | + needs: detect_changes |
| 109 | + if: ${{ needs.detect_changes.outputs.rust == 'true' }} |
| 110 | + runs-on: ubuntu-latest |
| 111 | + permissions: |
| 112 | + contents: read |
| 113 | + defaults: |
| 114 | + run: |
| 115 | + working-directory: rust |
| 116 | + steps: |
| 117 | + - name: Checkout |
| 118 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 119 | + - name: Setup Rust |
| 120 | + uses: dtolnay/rust-toolchain@0e66bd3e6b38ec0ad5312288c83e47c143e6b09e |
| 121 | + with: |
| 122 | + toolchain: 1.70.0 |
| 123 | + - name: Run build check |
| 124 | + run: cargo build --locked --verbose |
| 125 | + - name: Run execution check |
| 126 | + run: cargo run |
| 127 | + timeout-minutes: 1 |
| 128 | + |
| 129 | + typescript_build_check: |
| 130 | + name: TypeScript Build Check |
| 131 | + needs: detect_changes |
| 132 | + if: ${{ needs.detect_changes.outputs.typescript == 'true' }} |
| 133 | + runs-on: ubuntu-latest |
| 134 | + permissions: |
| 135 | + contents: read |
| 136 | + defaults: |
| 137 | + run: |
| 138 | + working-directory: typescript |
| 139 | + steps: |
| 140 | + - name: Checkout |
| 141 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 142 | + - name: Setup NodeJS |
| 143 | + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 |
| 144 | + with: |
| 145 | + node-version: 20.3.1 |
| 146 | + - name: Install package dependencies |
| 147 | + run: npm ci |
| 148 | + - name: Run lint check |
| 149 | + run: npm run lint |
| 150 | + - name: Run build check |
| 151 | + run: npm run dist:build |
| 152 | + - name: Run execution check |
| 153 | + run: npm start |
| 154 | + timeout-minutes: 1 |
0 commit comments