Integration tests #3062
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: | |
| workflow_dispatch: | |
| # no push trigger, this only runs nightly | |
| schedule: | |
| # Daily 5am australian/brisbane time (7pm UTC) | |
| - cron: "0 19 * * *" | |
| push: | |
| paths-ignore: | |
| - "**.md" | |
| - "releases.json" | |
| - ".github/**" | |
| env: | |
| SA_PASSWORD: ${{ secrets.DB_IMAGE_SA_PASSWORD }} | |
| ADMIN_API_KEY: ${{ secrets.OD_IMAGE_ADMIN_API_KEY }} | |
| SERVER_URL: "http://localhost:8080" | |
| jobs: | |
| test: | |
| # Dependabot-triggered runs cannot read Actions secrets -- GitHub scopes those | |
| # to a separate Dependabot secrets store -- so SA_PASSWORD resolves to empty, | |
| # SQL Server rejects every login, and the service container never turns | |
| # healthy. Skip rather than fail red: the nightly run on main covers merged | |
| # bumps, and `gh workflow run integration-test.yml --ref <branch>` still works | |
| # on a Dependabot branch, because the triggering actor is then a human. | |
| if: github.actor != 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04 | |
| env: | |
| ACCEPT_EULA: Y | |
| SA_PASSWORD: ${{ env.SA_PASSWORD }} | |
| MSSQL_PID: Developer | |
| options: >- | |
| --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P \"$SA_PASSWORD\" -Q \"SELECT 1\" || exit 1" | |
| --health-interval 10s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| --health-start-period 10s | |
| octopusserver: | |
| image: octopusdeploy/octopusdeploy:latest | |
| env: | |
| ACCEPT_EULA: Y | |
| DB_CONNECTION_STRING: "Server=sqlserver;Database=OctopusDeploy;User Id=sa;Password=${{ env.SA_PASSWORD }};" | |
| ADMIN_API_KEY: ${{ env.ADMIN_API_KEY }} | |
| ENABLE_USAGE: N | |
| OCTOPUS_SERVER_BASE64_LICENSE: ${{ secrets.OCTOPUS_SERVER_BASE64_LICENSE }} | |
| ports: | |
| - 8080:8080 | |
| permissions: # https://github.com/dorny/test-reporter/issues/168 | |
| statuses: write | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| - name: Setup gotestsum | |
| run: go install gotest.tools/gotestsum@latest | |
| # we don't technically need to run the unit tests but they're fast so why not | |
| - name: Unit Tests | |
| run: gotestsum --format testname --junitfile ../unit-tests.xml | |
| working-directory: ./pkg | |
| - name: Integration Tests | |
| env: | |
| OCTOPUS_TEST_URL: ${{ env.SERVER_URL }} | |
| OCTOPUS_TEST_APIKEY: ${{ env.ADMIN_API_KEY }} | |
| run: gotestsum --format testname --junitfile ../integration-tests.xml | |
| working-directory: ./test/integration | |
| - name: Test Report | |
| uses: dorny/test-reporter@v3 | |
| if: success() || failure() | |
| with: | |
| name: Test Results | |
| path: "*-tests.xml" | |
| reporter: java-junit |