feat: cancel voting (backend) #21303
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: Continuous Integration | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| merge_group: | |
| types: [checks_requested] | |
| workflow_run: | |
| workflows: ["Package"] | |
| branches: [main] | |
| types: | |
| - completed | |
| permissions: | |
| contents: read | |
| env: | |
| BASE_URL: https://${{ github.event.pull_request.number || 'main' }}.development.scrumlr.fra.ics.inovex.io | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-frontend: | |
| name: Build and Test – Frontend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Corepack # for yarn berry | |
| run: | | |
| npm install -g corepack@0.35.0 --ignore-scripts | |
| corepack enable | |
| corepack install | |
| - name: Setup Node.js with cache | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: "26" | |
| cache: "yarn" | |
| cache-dependency-path: "yarn.lock" | |
| - name: Install dependencies | |
| run: yarn install --immutable --mode=skip-build | |
| - name: Build client | |
| run: CI=false yarn build | |
| - name: Lint code | |
| run: yarn lint --max-warnings 0 | |
| - name: Test with coverage | |
| run: yarn test --run --coverage --passWithNoTests | |
| test-backend: | |
| name: Build and Test – Backend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: "^1.26" | |
| cache: false | |
| - name: Cache Go Modules | |
| id: cache-go-modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| /go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('server/src/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download Go Modules | |
| if: steps.cache-go-modules.outputs.cache-hit != 'true' | |
| working-directory: ./server/src | |
| run: go mod download | |
| - name: Verify Go Modules | |
| working-directory: ./server/src | |
| run: go list -m all | |
| - name: Check Go formatting | |
| working-directory: ./server | |
| run: make format-check | |
| - name: Go lint | |
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 | |
| with: | |
| version: v2.11.4 | |
| skip-cache: true | |
| working-directory: ./server/src/ | |
| - name: Build server | |
| working-directory: ./server | |
| run: | | |
| make test | |
| make build-alpine | |
| sonarqube: | |
| name: SonarQube | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: "^1.26" | |
| cache: false | |
| - name: Cache Go Modules | |
| id: cache-go-modules | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| /go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('server/src/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download Go Modules | |
| if: steps.cache-go-modules.outputs.cache-hit != 'true' | |
| working-directory: ./server/src | |
| run: go mod download | |
| - name: Verify Go Modules | |
| working-directory: ./server/src | |
| run: go list -m all | |
| - name: Get coverage report | |
| id: coverage | |
| working-directory: ./server | |
| run: | | |
| make test | |
| sed -i 's|scrumlr.io/server/|server/src/|g' src/coverage.txt | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| - name: SonarQube Quality Gate | |
| uses: SonarSource/sonarqube-quality-gate-action@7a5fffe8e523c40e0c740b6bc2712ab503e52efa # v1.2.1 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| package: | |
| if: github.event.pull_request.head.repo.fork == false | |
| needs: [test-frontend, test-backend] | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: ./.github/workflows/package.yml | |
| deploy_to_dev_cluster: | |
| needs: package | |
| permissions: | |
| id-token: write | |
| contents: read | |
| actions: read | |
| pull-requests: write | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' || github.ref_name == 'main' }} | |
| uses: ./.github/workflows/deploy_to_dev_cluster.yml | |
| secrets: inherit | |
| with: | |
| frontend_image_tag: ${{ needs.package.outputs.frontend-image-tag }} | |
| server_image_tag: ${{ needs.package.outputs.server-image-tag }} | |
| docs_changes: | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.fork == false || github.ref_name == 'main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: paths-filter | |
| id: docs_changes | |
| uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 | |
| with: | |
| filters: | | |
| docs: | |
| - 'docs/**' | |
| - name: set-output | |
| id: set-output | |
| run: echo "docs_changed=${{ steps.docs_changes.outputs.docs }}" >> $GITHUB_OUTPUT | |
| outputs: | |
| docs_changed: ${{ steps.set-output.outputs.docs_changed }} | |
| deploy_github_pages: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| needs: docs_changes | |
| if: ${{ needs.docs_changes.outputs.docs_changed == 'true' }} | |
| uses: ./.github/workflows/deploy_docs.yml | |
| secrets: inherit | |
| deployment_health_check: | |
| needs: deploy_to_dev_cluster | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' || github.ref_name == 'main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Reachability check | |
| uses: ./.github/actions/deployment_health_check | |
| with: | |
| HEALTH_URL: ${{ env.BASE_URL }}/api/health | |
| e2e_tests: | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }} | |
| needs: deployment_health_check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: "^1.26" | |
| cache: true | |
| cache-dependency-path: server/e2e-tests/go.sum | |
| - name: Run E2E tests | |
| working-directory: ./server/e2e-tests | |
| env: | |
| E2E_BASE_URL: ${{ env.BASE_URL }}/api | |
| E2E_INSECURE_SKIP_VERIFY: "true" | |
| run: go test ./... | |
| cypress_end_to_end_test: | |
| name: Cypress End to End Test | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]' }} | |
| needs: deployment_health_check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Corepack # for yarn berry | |
| run: | | |
| npm install -g corepack@0.35.0 --ignore-scripts | |
| corepack enable | |
| corepack install | |
| - name: Setup Node.js with cache | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: "26" | |
| cache: "yarn" | |
| cache-dependency-path: "yarn.lock" | |
| - name: Start server | |
| run: docker compose --profile build up -d | |
| working-directory: server | |
| - name: Setup client and run tests | |
| uses: cypress-io/github-action@fa4a118725a8f001170d49631ea89e5d66fee626 # v7.4.1 | |
| with: | |
| browser: chrome | |
| install-command: yarn install --immutable | |
| start: yarn run start | |
| working-directory: ./ | |
| wait-on: "http://localhost:5173" |