chore(ci): bump docker/login-action from 3.7.0 to 4.2.0 #128
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
| # CI pipeline for octo-speech | |
| # Runs on every pull request targeting main or release/** branches. | |
| # Designed to be used as required status checks in branch rulesets. | |
| name: CI | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review, converted_to_draft] | |
| branches: | |
| - main | |
| - 'release/**' | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - ".github/ISSUE_TEMPLATE/**" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GO_VERSION: '1.25.x' | |
| jobs: | |
| changes: | |
| name: Detect changed paths | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| code: ${{ github.event_name == 'pull_request' && steps.filter.outputs.code || 'true' }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| persist-credentials: false | |
| - uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050 # v3 | |
| id: filter | |
| if: github.event_name == 'pull_request' | |
| with: | |
| predicate-quantifier: 'every' | |
| filters: | | |
| code: | |
| - '!**/*.md' | |
| - '!docs/**' | |
| - '!.github/ISSUE_TEMPLATE/**' | |
| build: | |
| needs: [changes] | |
| if: | | |
| (github.event_name != 'pull_request' || !github.event.pull_request.draft) && | |
| needs.changes.outputs.code == 'true' | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Build speech binary | |
| run: CGO_ENABLED=0 go build -v ./cmd/speech/... | |
| - name: Build admin binary | |
| run: CGO_ENABLED=0 go build -v ./cmd/admin/... | |
| test: | |
| needs: [changes] | |
| if: | | |
| (github.event_name != 'pull_request' || !github.event.pull_request.draft) && | |
| needs.changes.outputs.code == 'true' | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: demo | |
| MYSQL_DATABASE: test | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -pdemo" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=20 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install MySQL client tooling | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq mysql-client | |
| - name: Wait for MySQL | |
| run: | | |
| for _ in $(seq 1 30); do | |
| if mysqladmin ping -h 127.0.0.1 -uroot -pdemo --silent; then | |
| echo "mysql ready" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "mysql did not become ready" >&2 | |
| exit 1 | |
| - name: Run tests | |
| run: | | |
| set -euo pipefail | |
| fail=0 | |
| while read -r pkg; do | |
| mysql -h 127.0.0.1 -uroot -pdemo -e "DROP DATABASE IF EXISTS test; CREATE DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" | |
| echo "::group::go test $pkg" | |
| if ! go test -race -shuffle=on -count=1 -timeout 5m "$pkg"; then | |
| fail=1 | |
| fi | |
| echo "::endgroup::" | |
| done < <(go list ./...) | |
| exit $fail | |
| vet: | |
| needs: [changes] | |
| if: | | |
| (github.event_name != 'pull_request' || !github.event.pull_request.draft) && | |
| needs.changes.outputs.code == 'true' | |
| name: Vet | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Vet | |
| run: go vet ./... | |
| lint: | |
| needs: [changes] | |
| if: | | |
| (github.event_name != 'pull_request' || !github.event.pull_request.draft) && | |
| needs.changes.outputs.code == 'true' | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| with: | |
| version: v2.12.2 | |
| args: --timeout=5m |