Integration tests #2468
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 | |
| on: | |
| schedule: | |
| - cron: '0 2 * * 1-5' | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| integration_tests: | |
| name: Integration Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| needs: build | |
| concurrency: | |
| # Only allow a single run of this workflow on each branch, automatically cancelling older runs. | |
| group: integration-tests-${{ github.head_ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 1 | |
| - name: Cache Swift tools build | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: .build | |
| key: tools-${{ runner.os }}-${{ hashFiles('Package.resolved') }} | |
| restore-keys: tools-${{ runner.os }}- | |
| - name: Setup environment | |
| run: | |
| source ci_scripts/ci_common.sh && setup_github_actions_environment | |
| - name: Download build products | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: integration-tests-build-products | |
| path: DerivedData/Build/Products | |
| - name: Extract build products | |
| run: | | |
| cd DerivedData/Build/Products | |
| tar -xzf build-products.tar.gz | |
| - name: Run tests | |
| run: | | |
| XCTESTRUN=$(ls DerivedData/Build/Products/*.xctestrun) | |
| swift run -q tools ci integration-tests --xctestrun-path "$XCTESTRUN" | |
| env: | |
| INTEGRATION_TESTS_HOST: ${{ secrets.INTEGRATION_TESTS_HOST }} | |
| INTEGRATION_TESTS_USERNAME: ${{ secrets.INTEGRATION_TESTS_USERNAME }} | |
| INTEGRATION_TESTS_PASSWORD: ${{ secrets.INTEGRATION_TESTS_PASSWORD }} | |
| - name: Archive artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| # We only care about artefacts if the tests fail | |
| if: failure() | |
| with: | |
| name: Results | |
| path: test_output/IntegrationTests.xcresult.zip | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Upload coverage to Codecov | |
| # Skip if not successful and in forks | |
| if: ${{ success() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} | |
| uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4 | |
| with: | |
| report_type: coverage | |
| files: test_output/integration-cobertura.xml | |
| disable_search: true | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: integrationtests | |
| - name: Upload test results to Codecov | |
| # Skip if cancelled and in forks | |
| if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} | |
| uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4 | |
| continue-on-error: true | |
| with: | |
| report_type: test_results | |
| files: test_output/integration-junit.xml | |
| disable_search: true | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: integrationtests | |
| build: | |
| name: Build Integration Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 1 | |
| - name: Cache Swift tools build | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: .build | |
| key: tools-${{ runner.os }}-${{ hashFiles('Package.resolved') }} | |
| restore-keys: tools-${{ runner.os }}- | |
| - name: Setup environment | |
| run: | |
| source ci_scripts/ci_common.sh && setup_github_actions_environment | |
| - name: Build tests | |
| run: swift run -q tools ci build --scheme IntegrationTests | |
| - name: Archive build products | |
| run: | | |
| cd DerivedData/Build/Products | |
| tar -czf build-products.tar.gz *.xctestrun Debug-iphonesimulator/ | |
| - name: Upload build products | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: integration-tests-build-products | |
| path: DerivedData/Build/Products/build-products.tar.gz | |
| retention-days: 1 | |
| server_login_tests: | |
| name: Server Login Tests (${{ matrix.server }}) | |
| runs-on: macos-26 | |
| environment: integration-tests | |
| timeout-minutes: 30 | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - server: default | |
| host_secret: INTEGRATION_TESTS_HOST | |
| username_secret: INTEGRATION_TESTS_USERNAME | |
| password_secret: INTEGRATION_TESTS_PASSWORD | |
| - server: lts | |
| host_secret: INTEGRATION_TESTS_LTS_HOST | |
| username_secret: INTEGRATION_TESTS_LTS_USERNAME | |
| password_secret: INTEGRATION_TESTS_LTS_PASSWORD | |
| - server: lts-1 | |
| host_secret: INTEGRATION_TESTS_LTS_1_HOST | |
| username_secret: INTEGRATION_TESTS_LTS_1_USERNAME | |
| password_secret: INTEGRATION_TESTS_LTS_1_PASSWORD | |
| concurrency: | |
| # Only allow a single run of this workflow on each branch, automatically cancelling older runs. | |
| group: server-login-tests-${{ matrix.server }}-${{ github.head_ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 1 | |
| - name: Cache Swift tools build | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: .build | |
| key: tools-${{ runner.os }}-${{ hashFiles('Package.resolved') }} | |
| restore-keys: tools-${{ runner.os }}- | |
| - name: Setup environment | |
| run: | |
| source ci_scripts/ci_common.sh && setup_github_actions_environment | |
| - name: Download build products | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: integration-tests-build-products | |
| path: DerivedData/Build/Products | |
| - name: Extract build products | |
| run: | | |
| cd DerivedData/Build/Products | |
| tar -xzf build-products.tar.gz | |
| - name: Run tests | |
| run: | | |
| XCTESTRUN=$(ls DerivedData/Build/Products/*.xctestrun) | |
| swift run -q tools ci server-login-tests --xctestrun-path "$XCTESTRUN" | |
| env: | |
| INTEGRATION_TESTS_HOST: ${{ secrets[matrix.host_secret] }} | |
| INTEGRATION_TESTS_USERNAME: ${{ secrets[matrix.username_secret] }} | |
| INTEGRATION_TESTS_PASSWORD: ${{ secrets[matrix.password_secret] }} | |
| - name: Archive artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| # We only care about artefacts if the tests fail | |
| if: failure() | |
| with: | |
| name: Results (${{ matrix.server }}) | |
| path: test_output/IntegrationTests.xcresult.zip | |
| retention-days: 7 | |
| if-no-files-found: ignore |