ci: run all the integration tests on PR or push #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Tests | ||
|
Check failure on line 1 in .github/workflows/integration-tests.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to checkout and test' | ||
| required: true | ||
| type: string | ||
| is_nightly: | ||
| description: 'Whether this is a nightly run' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| changes_only: | ||
| description: 'Only build tests affected by changes' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| commit_id: | ||
| description: 'Base commit ID for change comparison' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| jobs: | ||
| build-integration-tests: | ||
| runs-on: namespace-profile-large-ubuntu-24-04-amd64 | ||
| outputs: | ||
| test_binaries: ${{ steps.build.outputs.test_binaries }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # Fetch the entire history. | ||
| fetch-depth: 0 | ||
| ref: ${{ inputs.branch }} | ||
| - uses: ./.github/actions/bootstrap | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| # Setup pypy for running Python scripts (scripts/run_tests.py). | ||
| - uses: actions/setup-python@v5 | ||
| id: setup-pypy | ||
| with: | ||
| python-version: "pypy3.9" | ||
| cache: "pip" | ||
| - run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9 | ||
| - env: | ||
| LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin | ||
| run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV | ||
| - run: pip install -r scripts/requirements.txt | ||
| - name: "Build integration tests" | ||
| id: build | ||
| env: | ||
| IS_NIGHTLY: ${{ inputs.is_nightly }} | ||
| CHANGES_ONLY: ${{ inputs.changes_only }} | ||
| COMMIT_ID: ${{ inputs.commit_id }} | ||
| run: | | ||
| NIGHTLY_FLAG="" | ||
| if [[ "$IS_NIGHTLY" == "true" ]]; then | ||
| NIGHTLY_FLAG="--is_nightly" | ||
| fi | ||
| CHANGES_FLAGS="" | ||
| if [[ "$CHANGES_ONLY" == "true" ]]; then | ||
| CHANGES_FLAGS="--changes_only --include_dependencies" | ||
| if [[ -n "$COMMIT_ID" ]]; then | ||
| CHANGES_FLAGS="$CHANGES_FLAGS --commit_id \"$COMMIT_ID\"" | ||
| fi | ||
| fi | ||
| scripts/run_tests.py --command build_integration $NIGHTLY_FLAG $CHANGES_FLAGS | ||
| - name: "Upload integration test binaries" | ||
| if: steps.build.outputs.test_binaries | ||
| uses: namespace-actions/upload-artifact@v1 | ||
| with: | ||
| name: integration-test-binaries-${{ replace(inputs.branch || github.ref_name, '/', '-') }} | ||
| path: ./target/debug | ||
| compression-level: 0 | ||
| run-integration-tests: | ||
| needs: build-integration-tests | ||
| if: needs.build-integration-tests.outputs.test_binaries | ||
| runs-on: namespace-profile-large-ubuntu-24-04-amd64 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| test_binary: ${{ fromJson(needs.build-integration-tests.outputs.test_binaries) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
| ref: ${{ inputs.branch }} | ||
| - uses: ./.github/actions/bootstrap | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: "Download integration test binaries" | ||
| uses: namespace-actions/download-artifact@v1 | ||
| with: | ||
| name: integration-test-binaries-${{ replace(inputs.branch || github.ref_name, '/', '-') }} | ||
| path: ./target/debug | ||
| - name: "Restore executable permissions" | ||
| run: | | ||
| chmod +x ./target/debug/apollo_node | ||
| chmod +x ./target/debug/${{ matrix.test_binary }} | ||
| - name: "Run ${{ matrix.test_binary }}" | ||
| run: ./target/debug/${{ matrix.test_binary }} | ||
| env: | ||
| SEED: 0 | ||