Skip to content

Commit 2951fcf

Browse files
committed
GHA test/release pipeline
1 parent 89dfe3f commit 2951fcf

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/main.yml

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

0 commit comments

Comments
 (0)