deploy #11
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: CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [devel, cloud] | |
| tags: [v**] | |
| pull_request: | |
| branches: [main, cloud, devel] | |
| env: | |
| GITHUB_REGISTRY: ghcr.io | |
| DEV_CONTAINER_DOCKER_IMAGE: bencher-dev-container | |
| # Cancel in-progress runs for the same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Determine what changed | |
| changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| rust: ${{ steps.filter.outputs.rust }} | |
| console: ${{ steps.filter.outputs.console }} | |
| action: ${{ steps.filter.outputs.action }} | |
| api: ${{ steps.filter.outputs.api }} | |
| cli: ${{ steps.filter.outputs.cli }} | |
| docker: ${{ steps.filter.outputs.docker }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| rust: | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'lib/**' | |
| - 'plus/**' | |
| - 'services/api/**' | |
| - 'services/cli/**' | |
| - 'tasks/**' | |
| - 'xtask/**' | |
| console: | |
| - 'services/console/**' | |
| - 'lib/bencher_valid/**' | |
| action: | |
| - 'services/action/**' | |
| - 'services/api/openapi.json' | |
| api: | |
| - 'services/api/**' | |
| - 'lib/**' | |
| - 'plus/**' | |
| cli: | |
| - 'services/cli/**' | |
| - 'lib/**' | |
| docker: | |
| - 'services/api/Dockerfile' | |
| - 'services/console/Dockerfile' | |
| - 'docker/**' | |
| lint: | |
| name: Lint | |
| uses: ./.github/workflows/lint.yml | |
| with: | |
| mold-version: "2.34.1" | |
| typeshare-version: "1.13.2" | |
| cli: | |
| name: CLI | |
| needs: changes | |
| uses: ./.github/workflows/cli.yml | |
| with: | |
| bencher-version: "0.5.10" | |
| cli-changed: ${{ needs.changes.outputs.cli }} | |
| secrets: | |
| BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
| test: | |
| name: Test | |
| needs: changes | |
| if: needs.changes.outputs.rust == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') | |
| uses: ./.github/workflows/test.yml | |
| with: | |
| mold-version: "2.34.1" | |
| is-fork: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} | |
| secrets: | |
| TEST_BILLING_KEY: ${{ secrets.TEST_BILLING_KEY }} | |
| BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
| build: | |
| name: Build | |
| needs: changes | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| mold-version: "2.34.1" | |
| build-docker: ${{ needs.changes.outputs.docker == 'true' || github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || startsWith(github.ref, 'refs/tags/') }} | |
| build-cli: ${{ needs.changes.outputs.cli == 'true' || startsWith(github.ref, 'refs/tags/') }} | |
| deploy: | |
| name: Deploy | |
| needs: [lint, cli, test, build] | |
| if: ${{ github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) }} | |
| uses: ./.github/workflows/deploy.yml | |
| with: | |
| deploy-dev: ${{ github.ref == 'refs/heads/devel' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) }} | |
| deploy-test: ${{ github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud' }} | |
| deploy-prod: ${{ github.ref == 'refs/heads/cloud' }} | |
| secrets: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| # Summary job for required status checks | |
| ci-success: | |
| name: CI Success | |
| runs-on: ubuntu-22.04 | |
| needs: [lint, cli, test, build, deploy] | |
| if: always() | |
| steps: | |
| - name: Check all jobs passed | |
| run: | | |
| if [[ "${{ needs.lint.result }}" != "success" ]]; then | |
| echo "Lint failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.cli.result }}" != "success" ]]; then | |
| echo "CLI failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.test.result }}" != "success" && "${{ needs.test.result }}" != "skipped" ]]; then | |
| echo "Test failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.build.result }}" != "success" ]]; then | |
| echo "Build failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.deploy.result }}" != "success" && "${{ needs.deploy.result }}" != "skipped" ]]; then | |
| echo "Deploy failed" | |
| exit 1 | |
| fi | |
| echo "All required jobs passed!" | |
| build_dev_container: | |
| name: Build dev container | |
| if: ${{ github.ref == 'refs/heads/devel' }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GITHUB_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pre-build dev container image | |
| uses: devcontainers/ci@v0.3 | |
| with: | |
| imageName: ${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.DEV_CONTAINER_DOCKER_IMAGE }} | |
| cacheFrom: ${{ env.GITHUB_REGISTRY }}/${{ github.repository_owner }}/${{ env.DEV_CONTAINER_DOCKER_IMAGE }} | |
| push: always |