Skip to content

Commit 9d85d12

Browse files
committed
Add Github Actions configuration
1 parent c557094 commit 9d85d12

File tree

4 files changed

+67
-13
lines changed

4 files changed

+67
-13
lines changed

.github/workflows/build.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
go generate ./...
6+
7+
GOOS=${OS}
8+
[ "$GOOS" = "macos" ] && GOOS=darwin
9+
GOARCH="${ARCH}" GOOS="$GOOS" go build -tags netgo -o cftest ./cmd/cftest
10+
11+
mkdir -p build/cftest
12+
cp README.md build/cftest
13+
cp cftest build/cftest/cftest
14+
15+
cd build
16+
tar -czf "cftest-${OS}-${ARCH}-${REF}.tgz" cftest

.github/workflows/build.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build
2+
on: [push]
3+
env:
4+
GOPRIVATE: "github.com/paulhammond"
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
os: ["macos", "linux"]
12+
arch: ["arm64", "amd64"]
13+
fail-fast: false
14+
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.22.0'
22+
- name: Test
23+
run: go test -v ./...
24+
- name: Build
25+
env:
26+
OS: ${{ matrix.os }}
27+
ARCH: ${{ matrix.arch }}
28+
REF: ${{ github.sha }}
29+
run: "./.github/workflows/build.sh"
30+
- name: Upload
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: "cmd-${{matrix.os}}-${{matrix.arch}}-${{github.sha}}.tgz"
34+
path: "build/cmd-${{matrix.os}}-${{matrix.arch}}-${{github.sha}}.tgz"

.github/workflows/test.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Test
2+
on: [push]
3+
env:
4+
GOPRIVATE: "github.com/paulhammond"
5+
jobs:
6+
go:
7+
name: Go
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v4
12+
- name: Setup Go
13+
uses: actions/setup-go@v5
14+
with:
15+
go-version: '1.22.0'
16+
- name: Test
17+
run: go test -v ./...

Dockerfile

-13
This file was deleted.

0 commit comments

Comments
 (0)