chore(deps): update golang:1.20 docker digest to 098d628 #1031
Workflow file for this run
This file contains 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
--- | |
# based on https://github.com/mvdan/github-actions-golang | |
name: CI | |
on: | |
pull_request: | |
branches: ["main"] | |
paths-ignore: | |
- "docs/**" | |
- "config/version.txt" | |
- "README.md" | |
- "nix/**" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | |
with: | |
go-version: "^1.20.6" | |
- name: Checkout code | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
# cache go modules | |
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
bin | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run linting | |
if: matrix.os == 'ubuntu-latest' | |
run: make lint | |
- name: Run unittest | |
if: matrix.os == 'ubuntu-latest' | |
run: make test-coverage | |
- name: Go Coverage Badge | |
uses: tj-actions/coverage-badge-go@v2 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
green: 80 | |
filename: out/coverage.out | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v16 | |
if: matrix.os == 'ubuntu-latest' | |
id: verify-changed-files-coverage | |
with: | |
files: README.md | |
- name: Commit changes | |
if: steps.verify-changed-files-coverage.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "chore(docs): update coverage badge" | |
- name: Build package | |
run: make build | |
- name: Execute build | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
run: ./out/bin/gt --help | |
- name: Execute build | |
if: matrix.os == 'windows-latest' | |
run: ./out/bin/gt.exe --help | |
- name: Create a test project & test it | |
run: | | |
make testing-project-default | |
make -C testing-project ci | |
make -C testing-project all | |
- name: Test generate projects | |
run: make testing-project-ci | |
- name: Run generate | |
if: matrix.os == 'ubuntu-latest' | |
run: make generate | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v16 | |
if: matrix.os == 'ubuntu-latest' | |
id: verify-changed-files-generate | |
with: | |
files: | | |
nix/gomod2nix.toml | |
docs/options.md | |
- name: Commit changes | |
if: steps.verify-changed-files-generate.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add nix/gomod2nix.toml docs/options.md | |
git commit -m "chore: regenerate files" | |
- name: Push changes | |
if: steps.verify-changed-files-coverage.outputs.files_changed == 'true' || steps.verify-changed-files-generate.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.SIT_BOT_PAT }} | |
branch: ${{ github.head_ref }} |