|
| 1 | +name: Continuous integration |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: main |
| 5 | + pull_request: |
| 6 | + branches: main |
| 7 | + workflow_dispatch: # allows manual triggering |
| 8 | + schedule: |
| 9 | + - cron: '1 11 * * *' |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} |
| 14 | + |
| 15 | +jobs: |
| 16 | + unit_tests: |
| 17 | + name: Unit Tests |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [ubuntu-latest, macos-latest] |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + steps: |
| 24 | + - name: Checkout the repository |
| 25 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 26 | + - uses: ./.github/actions/set_up_runner |
| 27 | + with: |
| 28 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - name: Execute Bazel tests |
| 30 | + shell: bash |
| 31 | + run: bazel test //... |
| 32 | + |
| 33 | + integration_tests: |
| 34 | + name: Integration Tests |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + os: [ubuntu-latest, macos-latest] |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + steps: |
| 41 | + - name: Checkout the repository |
| 42 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 43 | + - uses: ./.github/actions/set_up_runner |
| 44 | + with: |
| 45 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + - name: Execute simple |
| 47 | + uses: ./ |
| 48 | + with: |
| 49 | + verbose: true |
| 50 | + working-directory: ./tests/integration_tests |
| 51 | + options: | |
| 52 | + --arg customVarBool true |
| 53 | + --argstr customVarStr "Hello, World!" |
| 54 | + run: | |
| 55 | + echo "FIRST" > integration_test.out |
| 56 | + echo "${CUSTOM_VAR_BOOL}" >> integration_test.out |
| 57 | + echo "${CUSTOM_VAR_STR}" >> integration_test.out |
| 58 | + - name: Confirm output |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + output="$(<./tests/integration_tests/integration_test.out)" |
| 62 | + expected="$(cat <<-EOF |
| 63 | + FIRST |
| 64 | + true |
| 65 | + Hello, World! |
| 66 | + EOF |
| 67 | + )" |
| 68 | + [[ "${output}" == "${expected}" ]] || \ |
| 69 | + (echo >&2 "Ouptput from integration test does not match:" "${output}"; exit 1) |
| 70 | +
|
| 71 | + all_ci_tests: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: |
| 74 | + - unit_tests |
| 75 | + - integration_tests |
| 76 | + if: ${{ always() }} |
| 77 | + steps: |
| 78 | + - uses: cgrindel/gha_join_jobs@794a2d117251f22607f1aab937d3fd3eaaf9a2f5 # v1 |
| 79 | + with: |
| 80 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments