Skip to content

Merge pull request #80 from JosiahWitt/run-parallel #471

Merge pull request #80 from JosiahWitt/run-parallel

Merge pull request #80 from JosiahWitt/run-parallel #471

Workflow file for this run

name: CI
on: [push]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.16", "1.17", "1.18", "1.19", "1.20"]
path: [".", "cmd/ensure", "exp/entable"]
include:
- path: "."
flags: package
- path: cmd/ensure
flags: cli
- path: exp/entable
flags: entable
exclude:
- path: exp/entable # Entable requires generics
go-version: "1.16"
- path: exp/entable # Entable requires generics
go-version: "1.17"
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Test `${{ matrix.path }}`
run: (cd ${{ matrix.path }}; go test -race -coverprofile=./coverage.txt -covermode=atomic ./...)
- name: Upload `${{ matrix.path }}` coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ matrix.path }}/coverage.txt
flags: ${{ matrix.flags }}
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.16", "1.17", "1.18", "1.19", "1.20"]
path: [".", "cmd/ensure", "exp/entable"]
exclude:
- path: "exp/entable" # Entable requires generics
go-version: "1.16"
- path: "exp/entable" # Entable requires generics
go-version: "1.17"
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Lint `${{ matrix.path }}`
uses: golangci/golangci-lint-action@v2
with:
version: v1.51.0
skip-go-installation: true
working-directory: ${{ matrix.path }}
staticcheck:
name: Staticcheck
runs-on: ubuntu-latest
strategy:
matrix:
# Staticcheck requires Go 1.19+
go-version: ["1.19", "1.20"]
path: [".", "cmd/ensure", "exp/entable"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Staticcheck `${{ matrix.path }}`
uses: dominikh/staticcheck-action@v1
with:
version: "2023.1"
install-go: false
working-directory: ${{ matrix.path }}
regression-test:
name: Regression Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.16", "1.17", "1.18", "1.19", "1.20"]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Generate Package Mocks
run: make generate-mocks
- name: Generate CLI Mocks
run: (cd cmd/ensure; make generate-mocks)
- name: Run go fmt for package
run: go fmt ./...
- name: Run go fmt for CLI
run: (cd cmd/ensure; go fmt ./...)
- name: Git diff
run: git diff
- name: Verify mocks are up-to-date
run: |
git status --porcelain | grep mocks/ || true
if [[ $(git status --porcelain | grep mocks/ 2> /dev/null) ]]; then
echo "❌ Please run `make generate-mocks`";
exit 1;
else
echo "✅ `make generate-mocks` was run";
fi