acceptance-stage #5415
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: acceptance-stage | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' # Run every 30 minutes | |
| workflow_dispatch: | |
| inputs: | |
| force_run: | |
| description: 'Force run (even if no new images)' | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: acceptance-stage | |
| cancel-in-progress: true | |
| jobs: | |
| find-latest-images: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image-digest-urls: ${{ steps.get-digest.outputs.image-digest-urls }} | |
| latest-image-timestamp: ${{ steps.get-digest.outputs.latest-image-timestamp }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Resolve Latest Docker Digests | |
| id: get-digest | |
| uses: optivem/find-latest-docker-images-action@v1 | |
| with: | |
| image-urls: | | |
| ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/monolith:latest | |
| should-run: | |
| needs: find-latest-images | |
| if: needs.find-latest-images.result == 'success' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should-run }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Should Run Acceptance Stage | |
| id: check | |
| uses: optivem/should-run-acceptance-stage-action@v1 | |
| with: | |
| latest-image-timestamp: ${{ needs.find-latest-images.outputs.latest-image-timestamp }} | |
| force-run: ${{ inputs.force_run == true }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| system-test: | |
| needs: [should-run, find-latest-images] | |
| if: needs.should-run.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Deploy System | |
| id: deploy-system | |
| uses: ./.github/actions/deploy-docker-images | |
| with: | |
| environment: acceptance | |
| version: latest | |
| image-urls: ${{ needs.find-latest-images.outputs.image-digest-urls }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install Python Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| working-directory: system-test | |
| - name: Run Acceptance Tests | |
| run: echo "Run Acceptance Tests" | |
| - name: Run External System Contract Tests | |
| run: echo "Run External System Contract Tests" | |
| - name: Run E2E Tests | |
| run: pytest . -m e2e -v | |
| working-directory: system-test | |
| prerelease: | |
| needs: [find-latest-images, should-run, system-test] | |
| if: needs.system-test.result == 'success' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.generate-version.outputs.version }} | |
| image-urls: ${{ steps.tag-images.outputs.image-urls }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history and tags | |
| - name: Generate Prerelease Version | |
| id: generate-version | |
| uses: optivem/generate-prerelease-version-action@v1 | |
| - name: Tag Docker Images for Prerelease | |
| id: tag-images | |
| uses: optivem/tag-docker-images-action@v1 | |
| with: | |
| image-urls: ${{ needs.find-latest-images.outputs.image-digest-urls }} | |
| tag: ${{ steps.generate-version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Prerelease | |
| id: create-release | |
| uses: optivem/create-release-action@v1 | |
| with: | |
| base-version: latest | |
| release-version: ${{ steps.generate-version.outputs.version }} | |
| environment: acceptance | |
| status: prerelease | |
| artifact-urls: ${{ steps.tag-images.outputs.image-urls }} | |
| is-prerelease: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| summary: | |
| needs: [find-latest-images, should-run, prerelease, system-test] | |
| if: always() # Run even if previous jobs fail | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Acceptance Stage Summary | |
| uses: optivem/summarize-system-stage-action@v1 | |
| with: | |
| stage-name: 'Acceptance Stage' | |
| environment: acceptance | |
| stage-result: ${{ needs.prerelease.result }} | |
| success-version: ${{ needs.prerelease.outputs.version }} | |
| success-artifact-ids: ${{ needs.prerelease.outputs.image-urls }} |