Skip to content

Commit 44b5951

Browse files
committed
build: Add up-to-date hydrun build configuration for tests, binaries and PWAs
Signed-off-by: Felicitas Pojtinger <[email protected]>
1 parent 6fff5d9 commit 44b5951

File tree

1 file changed

+102
-25
lines changed

1 file changed

+102
-25
lines changed

.github/workflows/hydrun.yaml

Lines changed: 102 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,127 @@ name: hydrun CI
33
on:
44
push:
55
pull_request:
6+
schedule:
7+
- cron: "0 0 * * 0"
68

79
jobs:
810
build-linux:
9-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.target.runner }}
12+
permissions:
13+
contents: read
14+
strategy:
15+
matrix:
16+
target:
17+
# Tests
18+
- id: test-cli
19+
src: .
20+
os: golang:bookworm
21+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
22+
cmd: GOFLAGS="-short" ./Hydrunfile test/cli
23+
dst: out/nonexistent
24+
runner: ubuntu-latest
25+
- id: test-pwa
26+
src: .
27+
os: golang:bookworm
28+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
29+
cmd: GOFLAGS="-short" ./Hydrunfile test/pwa
30+
dst: out/nonexistent
31+
runner: ubuntu-latest
32+
33+
# Binaries
34+
- id: go.bofied-backend
35+
src: .
36+
os: golang:bookworm
37+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
38+
cmd: ./Hydrunfile build/cli bofied-backend
39+
dst: out/*
40+
runner: ubuntu-latest
41+
- id: go.bofied-frontend
42+
src: .
43+
os: golang:bookworm
44+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
45+
cmd: ./Hydrunfile build/cli bofied-frontend
46+
dst: out/*
47+
runner: ubuntu-latest
48+
49+
# PWAs
50+
- id: pwa.bofied
51+
src: .
52+
os: golang:bookworm
53+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
54+
cmd: ./Hydrunfile build/pwa
55+
dst: out/*
56+
runner: ubuntu-latest
57+
- id: pwa.bofied-github-pages
58+
src: .
59+
os: golang:bookworm
60+
flags: -e '-v /tmp/ccache:/root/.cache/go-build'
61+
cmd: ./Hydrunfile build/pwa-github-pages && mv out/frontend.tar.gz out/frontend-github-pages.tar.gz
62+
dst: out/*
63+
runner: ubuntu-latest
1064

1165
steps:
1266
- name: Checkout
13-
uses: actions/checkout@v2
67+
uses: actions/checkout@v4
68+
- name: Restore ccache
69+
uses: actions/cache/restore@v4
70+
with:
71+
path: |
72+
/tmp/ccache
73+
key: cache-ccache-${{ matrix.target.id }}
1474
- name: Set up QEMU
15-
uses: docker/setup-qemu-action@v1
75+
uses: docker/setup-qemu-action@v3
1676
- name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v1
77+
uses: docker/setup-buildx-action@v3
1878
- name: Set up hydrun
1979
run: |
2080
curl -L -o /tmp/hydrun "https://github.com/pojntfx/hydrun/releases/latest/download/hydrun.linux-$(uname -m)"
2181
sudo install /tmp/hydrun /usr/local/bin
22-
- name: Build backend with hydrun
23-
run: hydrun -a amd64,arm64,arm/v7 ./Hydrunfile
24-
- name: Build frontend with hydrun
25-
run: hydrun "./Hydrunfile frontend"
82+
- name: Build with hydrun
83+
working-directory: ${{ matrix.target.src }}
84+
run: hydrun -o ${{ matrix.target.os }} ${{ matrix.target.flags }} "${{ matrix.target.cmd }}"
85+
- name: Fix permissions for output
86+
run: sudo chown -R $USER .
87+
- name: Save ccache
88+
uses: actions/cache/save@v4
89+
with:
90+
path: |
91+
/tmp/ccache
92+
key: cache-ccache-${{ matrix.target.id }}
93+
- name: Upload output
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: ${{ matrix.target.id }}
97+
path: ${{ matrix.target.dst }}
98+
99+
publish-linux:
100+
runs-on: ubuntu-latest
101+
permissions:
102+
contents: write
103+
needs: build-linux
104+
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v4
108+
- name: Download output
109+
uses: actions/download-artifact@v4
110+
with:
111+
path: /tmp/out
112+
- name: Extract branch name
113+
id: extract_branch
114+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
26115
- name: Publish pre-release to GitHub releases
27116
if: ${{ github.ref == 'refs/heads/main' }}
28-
uses: marvinpinto/action-automatic-releases@latest
117+
uses: softprops/action-gh-release@v2
29118
with:
30-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
31-
automatic_release_tag: unstable
119+
tag_name: release-${{ steps.extract_branch.outputs.branch }}
32120
prerelease: true
33121
files: |
34-
out/release/bofied-backend/*
35-
out/release/bofied-frontend/*
122+
/tmp/out/*/*
36123
- name: Publish release to GitHub releases
37124
if: startsWith(github.ref, 'refs/tags/v')
38-
uses: marvinpinto/action-automatic-releases@latest
125+
uses: softprops/action-gh-release@v2
39126
with:
40-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
41127
prerelease: false
42128
files: |
43-
out/release/bofied-backend/*
44-
out/release/bofied-frontend/*
45-
- name: Publish release to GitHub pages
46-
if: startsWith(github.ref, 'refs/tags/v')
47-
uses: JamesIves/[email protected]
48-
with:
49-
branch: gh-pages
50-
folder: out/release/bofied-frontend-github-pages
51-
git-config-name: GitHub Pages Bot
52-
git-config-email: [email protected]
129+
/tmp/out/*/*

0 commit comments

Comments
 (0)