CI #113
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: | |
| schedule: | |
| - cron: "0 12 * * 6" | |
| push: | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/_build.yml | |
| with: | |
| image: ghcr.io/${{ github.repository }}-ci:run-${{ github.run_id }} | |
| platforms: linux/amd64 | |
| test-ruby: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/${{ github.repository }}-ci:run-${{ github.run_id }} | |
| services: | |
| mariadb: | |
| image: mariadb:latest | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MARIADB_ROOT_PASSWORD: root | |
| options: >- | |
| --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| ruby-version: "3.4" | |
| env: | |
| BUNDLE_GEMFILE: test/ruby/Gemfile | |
| - run: | | |
| bundle install | |
| bundle exec rspec | |
| working-directory: test/ruby | |
| test-go: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/${{ github.repository }}-ci:run-${{ github.run_id }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| cache-dependency-path: test/go/go.sum | |
| - run: go test -v | |
| working-directory: test/go | |
| publish: | |
| needs: [test-ruby, test-go] | |
| if: github.ref == 'refs/heads/main' | |
| uses: ./.github/workflows/_build.yml | |
| with: | |
| image: ghcr.io/${{ github.repository }}:latest | |
| # TODO: Figure out how to make this work with branch protection rules. | |
| # Essentially the GITHUB_TOKEN needs permissions to bypass the protection | |
| # rules. | |
| # versions: | |
| # needs: [publish] | |
| # runs-on: ubuntu-latest | |
| # permissions: | |
| # contents: write | |
| # container: | |
| # image: ghcr.io/${{ github.repository }}:latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - run: ./scripts/extract-versions.sh > versions.json | |
| # # Note: This step commits and pushes using the automatic GitHub token | |
| # # secret, avoiding an infinite loop of workflow runs. | |
| # - uses: stefanzweifel/git-auto-commit-action@v5 | |
| # with: | |
| # commit_message: "chore(ci): update versions.json" | |
| # file_pattern: "versions.json" |