Skip to content

Commit 3b848b4

Browse files
committed
GHA test/release pipeline
1 parent 96aa61d commit 3b848b4

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Main pipeline
2+
3+
on:
4+
push:
5+
branches: [ "master", "freva/devel" ]
6+
pull_request:
7+
release:
8+
types: [ published ]
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
frontend:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
cache: 'pnpm'
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v3
27+
with:
28+
version: 10
29+
30+
- name: Install Dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Typecheck
34+
run: pnpm typecheck
35+
36+
- name: Lint
37+
run: pnpm lint
38+
39+
- name: Test
40+
run: pnpm test
41+
42+
- name: Build Frontend
43+
run: |
44+
make ui
45+
46+
- name: Setup Go
47+
uses: actions/setup-go@v5
48+
with:
49+
cache: true
50+
go-version-file: 'go.mod'
51+
52+
- name: Test Backend
53+
run: make test
54+
55+
- name: Build Go Binaries
56+
run: |
57+
# os/arch/extension
58+
TARGETS=("linux/amd64/" "linux/arm64/" "darwin/amd64/" "darwin/arm64/" "windows/amd64/.exe")
59+
60+
for target in "${TARGETS[@]}"; do
61+
IFS="/" read -r OS ARCH EXT <<< "$target"
62+
63+
echo "Building for $OS-$ARCH..."
64+
PLATFORM_DIR="dist/${OS}_${ARCH}"
65+
mkdir -p "$PLATFORM_DIR"
66+
67+
for d in cmd/*/; do
68+
binary_name=$(basename "$d")
69+
GOOS=$OS GOARCH=$ARCH go build -o "${PLATFORM_DIR}/${binary_name}${EXT}" "$d"
70+
done
71+
72+
VERSION=${{ github.event.release.tag_name || 'dev' }}
73+
if [ "$OS" == "windows" ]; then
74+
cd dist && zip -r "../codesearch-${VERSION}-${OS}-${ARCH}.zip" "${OS}_${ARCH}" && cd ..
75+
else
76+
tar -cvzf "codesearch-${VERSION}-${OS}-${ARCH}.tar.gz" -C dist "${OS}_${ARCH}"
77+
fi
78+
done
79+
80+
- name: Upload to Release
81+
if: github.event_name == 'release'
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
files: |
85+
*.tar.gz
86+
*.zip
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)