ci: trigger docs on tag push #604
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: build | |
on: [push, pull_request] | |
jobs: | |
lint: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- uses: actions/checkout@v4 | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.64.4 | |
test_windows: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- uses: actions/checkout@v4 | |
- run: go build ./cmd/goverter | |
- run: go test ./... | |
test: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- uses: actions/checkout@v4 | |
- run: go build ./cmd/goverter | |
- run: go test -coverpkg ./... -coverprofile=coverage.txt -covermode=atomic ./... | |
- run: grep -v '/example/' coverage.txt > filtered-coverage.txt | |
- uses: codecov/codecov-action@v4 | |
with: | |
disable_search: true | |
files: ./filtered-coverage.txt | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
test_latest_xtools: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- uses: actions/checkout@v4 | |
- run: | | |
go get -u golang.org/x/tools | |
go mod tidy | |
- run: go test ./... | |
env: | |
SKIP_VERSION_DEPENDENT: 'true' | |
test_go122: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
- uses: actions/checkout@v4 | |
- run: go build ./cmd/goverter | |
- run: go test ./... | |
env: | |
SKIP_VERSION_DEPENDENT: 'true' | |
generate: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.24.x | |
- uses: actions/checkout@v4 | |
- run: mkdir covdata | |
- run: GOCOVERDIR="$PWD/covdata" go generate ./... | |
- run: go tool covdata textfmt -i=./covdata -o example-coverage.txt | |
- uses: codecov/codecov-action@v4 | |
with: | |
disable_search: true | |
files: ./example-coverage.txt | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- run: git diff --exit-code | |
- if: failure() | |
run: echo "::error::Check failed, please run 'go generate ./...' and commit the changes." | |
build_docs: | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: yarn | |
cache-dependency-path: docs/yarn.lock | |
- working-directory: docs | |
run: | | |
yarn install --frozen-lockfile | |
yarn docs:build |