Skip to content

Commit

Permalink
Factor out test GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed May 21, 2020
1 parent c1cffd4 commit 39af976
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code quality
on:
pull_request:
push:
branches:
- master
tags:
- v*
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout
uses: actions/checkout@v2
- name: Generate
run: |
go generate
git diff --exit-code
- name: Check formatting
run: |
make format
git diff --exit-code
golangci-lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.27
18 changes: 0 additions & 18 deletions .github/workflows/golangci-lint.yml

This file was deleted.

17 changes: 3 additions & 14 deletions .github/workflows/chezmoi.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: chezmoi
name: Test
on:
pull_request:
push:
branches:
- master
tags:
- 'v*'
- v*
jobs:
test:
strategy:
Expand All @@ -31,27 +31,17 @@ jobs:
${{ runner.os }}-go-
- name: Checkout
uses: actions/checkout@v2
- name: Generate
if: matrix.os == 'ubuntu-latest'
run: |
go generate
git diff --exit-code
- name: Build
run: go build ./...
- name: Run
run: go run . --version
- name: Test
run: go test -race ./...
- name: Check formatting
if: matrix.os == 'ubuntu-latest'
run: |
make format
git diff --exit-code
- name: Install snapcraft
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
- name: Release
- name: Build release
if: matrix.os == 'ubuntu-latest'
uses: goreleaser/goreleaser-action@v1
with:
Expand All @@ -66,7 +56,6 @@ jobs:
./dist/chezmoi-nocgo_linux_386/chezmoi --version | tee /dev/stderr | grep -q "chezmoi version v"
./dist/chezmoi-nocgo-snap_linux_386/chezmoi --version | tee /dev/stderr | grep -q "chezmoi version v"
release:
name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs:
- test
Expand Down

0 comments on commit 39af976

Please sign in to comment.