Skip to content

Commit

Permalink
feat(ci): create ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nobe4 committed Jun 12, 2024
1 parent 096a62b commit b9149d7
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches: [ main ]
paths:
- "**.go"
- go.mod
- go.sum
pull_request:
branches: [ main ]
paths:
- "**.go"
- go.mod
- go.sum

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Build
run: go build -v ./cmd/gh-not

- name: Test
run: go test -v ./...

# Taken from https://github.com/cli/cli/blob/trunk/.github/workflows/lint.yml
- name: Lint
run: |
STATUS=0
assert-nothing-changed() {
local diff
"$@" >/dev/null || return 1
if ! diff="$(git diff -U1 --color --exit-code)"; then
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
git checkout -- .
STATUS=1
fi
}
assert-nothing-changed go fmt ./...
assert-nothing-changed go mod tidy
exit $STATUS

0 comments on commit b9149d7

Please sign in to comment.