-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (89 loc) · 2.96 KB
/
ci.yml
File metadata and controls
101 lines (89 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
on:
pull_request:
types: [opened, synchronize]
branches:
- main
permissions:
contents: read
checks: write
pull-requests: write
jobs:
test:
name: Run short test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run tests in short mode
env:
CGO_LDFLAGS: -lm
run: |
go install gotest.tools/gotestsum
echo "Running tests in short mode"
gotestsum --junitfile test-results.xml --format testname -- -short ./tests/end2end/...
- name: Publish test results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: test-results.xml
check_name: CI Test Results
fail_on: 'nothing'
comment_mode: off
build:
name: Build
strategy:
matrix:
include:
- goos: linux
goarch: amd64
runner: ubuntu-latest
- goos: linux
goarch: arm64
runner: ubuntu-latest
- goos: darwin
goarch: amd64
runner: macos-latest
- goos: darwin
goarch: arm64
runner: macos-latest
- goos: windows
goarch: amd64
runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install Linux ARM64 cross-compilation toolchain (Linux ARM64 only)
if: matrix.goos == 'linux' && matrix.goarch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
echo "AR=aarch64-linux-gnu-ar" >> $GITHUB_ENV
echo "AS=aarch64-linux-gnu-as" >> $GITHUB_ENV
- name: Build binary
env:
CGO_ENABLED: 1
CGO_LDFLAGS: -lm
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -ldflags="-s -w -X github.com/dirathea/sstart/internal/cli.version=snapshot -X github.com/dirathea/sstart/internal/cli.commit=${{ github.sha }} -X github.com/dirathea/sstart/internal/cli.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -o sstart${{ matrix.goos == 'windows' && '.exe' || '' }} ./cmd/sstart
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: sstart-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
path: sstart${{ matrix.goos == 'windows' && '.exe' || '' }}
retention-days: 1