Skip to content

feat: Implement 2021/day08 puzzle #873

feat: Implement 2021/day08 puzzle

feat: Implement 2021/day08 puzzle #873

Workflow file for this run

name: Go [lint, test]
on:
workflow_dispatch:
push:
branches:
- 'master'
paths:
- 'scripts/**'
- 'tools/**'
- '**/*.go'
- '**/*.gohtml'
- '**/*.proto'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '!**.*md'
- '.github/workflows/**'
- '!.github/workflows/readme-stars.yml'
pull_request:
types: [ opened, synchronize, reopened ]
branches:
- '*'
paths:
- 'scripts/**'
- 'tools/**'
- '**/*.go'
- '**/*.gohtml'
- '**/*.proto'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '!**.*md'
- '.github/workflows/**'
- '!.github/workflows/readme-stars.yml'
jobs:
build:
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [ 'ubuntu-22.04' ]
go-version: [1.21]
runs-on: ${{ matrix.os }}
name: Build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- run: |
go version
shell: bash
- name: Set up cache
uses: actions/cache@v3
env:
cache-name: cache-vendored-tools-${{ secrets.CACHE_VERSION }}
with:
path: |
${{ env.GOBIN }}
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
- name: Install tools
run: |
make install-tools
shell: bash
- name: Build
run: |
make build
shell: bash
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
- name: Check release
run: |
make check-releaser
shell: bash
testing:
strategy:
fail-fast: false
max-parallel: 2
matrix:
os: [ 'ubuntu-22.04' ]
go-version: [1.21]
runs-on: ${{ matrix.os }}
name: Run Tests
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- run: |
go version
shell: bash
- name: Set up cache
uses: actions/cache@v3
env:
cache-name: cache-vendored-tools-${{ secrets.CACHE_VERSION }}
with:
path: |
${{ env.GOBIN }}
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
- name: Install tools
run: |
make install-tools
shell: bash
- name: Test
run: |
make test
shell: bash
linting:
strategy:
fail-fast: false
max-parallel: 2
matrix:
os: [ 'ubuntu-22.04' ]
go-version: [1.21]
runs-on: ${{ matrix.os }}
name: Run linters
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- run: |
go version
shell: bash
- name: Install tools
run: |
make install-tools
shell: bash
- name: Vet
run: |
make vet
shell: bash
- name: Set up cache
uses: actions/cache@v3
env:
cache-name: cache-vendored-tools-${{ secrets.CACHE_VERSION }}
with:
path: |
${{ env.GOBIN }}
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
- name: Install tools
run: |
make install-tools
shell: bash
- name: Lint
run: |
make lint-pipeline
shell: bash
reports:
needs: [ testing, linting, build ]
strategy:
fail-fast: true
max-parallel: 1
matrix:
os: [ 'ubuntu-22.04' ]
go-version: [1.21]
runs-on: ${{ matrix.os }}
name: Quality reports
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- run: |
go version
shell: bash
- name: Set up cache
uses: actions/cache@v3
env:
cache-name: cache-vendored-tools-${{ secrets.CACHE_VERSION }}
with:
path: |
${{ env.GOBIN }}
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/tools/go.sum') }}
- name: Install tools
run: |
make install-tools
shell: bash
- name: Prepare test coverage and reports
run: |
make prepare-cover-report
shell: bash
- name: Prepare lint report
run: |
make lint-sonar
shell: bash
- name: Cover report upload
if: success()
run: |
bash <(curl -s https://codecov.io/bash) -f ./coverage/full.cov
shell: bash
- name: SonarCloud report upload
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}