Skip to content

Commit 75b7dcd

Browse files
committed
Add CI
1 parent 4498d35 commit 75b7dcd

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.github/workflows/_check.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: check
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
check:
8+
runs-on: ubuntu-24.04
9+
timeout-minutes: 15
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
steps:
14+
- uses: actions/checkout@v4.2.2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Install Nix
19+
uses: cachix/install-nix-action@v27
20+
21+
- name: Run the Magic Nix Cache
22+
uses: DeterminateSystems/magic-nix-cache-action@v7
23+
24+
- name: Setup flake environment
25+
run: nix develop -c sleep 0
26+
shell: bash
27+
28+
- name: Check Go format
29+
run: nix develop -c ./scripts/check-fmt.sh
30+
31+
- name: Vet
32+
run: nix develop -c go vet ./...
33+
34+
- name: Test
35+
run: nix develop -c go test ./...
36+
37+
- name: Build
38+
run: nix build

.github/workflows/master.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Master
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
check:
9+
uses: ./.github/workflows/_check.yml

.github/workflows/prs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Pull requests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check:
8+
uses: ./.github/workflows/_check.yml

scripts/check-fmt.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
UNFORMATTED_FILES=$(gofmt -l .)
4+
5+
if [ -n "$UNFORMATTED_FILES" ]; then
6+
echo "The following files are not formatted:"
7+
echo "$UNFORMATTED_FILES"
8+
exit 1
9+
fi

0 commit comments

Comments
 (0)