Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Build and Release BackApp
name: Build BackApp

on:
push:
tags:
- 'v*'
workflow_dispatch:
workflow_call:

permissions:
contents: write
contents: read

jobs:
frontend:
Expand All @@ -24,7 +22,7 @@ jobs:
cache: 'npm'
cache-dependency-path: web/package-lock.json

- name: Build frontend (Node stage)
- name: Build frontend
working-directory: web
run: |
if [ -f package-lock.json ]; then
Expand All @@ -39,6 +37,7 @@ jobs:
with:
name: web-build
path: server/static
retention-days: 30

build-linux-amd64:
name: Build Linux x86_64 Binary
Expand All @@ -59,7 +58,7 @@ jobs:
with:
go-version-file: server/go.mod

- name: Configure Go proxy (fallback)
- name: Configure Go proxy
run: |
go env -w GOPROXY=https://goproxy.io,direct
go env -w GOSUMDB=sum.golang.org
Expand All @@ -79,6 +78,7 @@ jobs:
with:
name: backapp-server-linux-amd64
path: server/backapp-server-linux-amd64
retention-days: 30

build-linux-arm64:
name: Build Linux ARM64 Binary
Expand All @@ -94,15 +94,15 @@ jobs:
name: web-build
path: server/static

- name: Install cross compiler (arm64)
- name: Install cross compiler
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: server/go.mod

- name: Configure Go proxy (fallback)
- name: Configure Go proxy
run: |
go env -w GOPROXY=https://goproxy.io,direct
go env -w GOSUMDB=sum.golang.org
Expand All @@ -123,6 +123,7 @@ jobs:
with:
name: backapp-server-linux-arm64
path: server/backapp-server-linux-arm64
retention-days: 30

build-raspberry-pi:
name: Build Raspberry Pi 2 Binary
Expand All @@ -140,18 +141,15 @@ jobs:
name: web-build
path: server/static

- name: Install cross compiler (armv7)
- name: Install cross compiler
run: apt-get update && apt-get install -y gcc-arm-linux-gnueabihf ca-certificates

- name: Verify CA store
run: ls -l /etc/ssl/certs || true

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: server/go.mod

- name: Configure Go proxy (fallback)
- name: Configure Go proxy
run: |
go env -w GOPROXY=https://goproxy.io,direct
go env -w GOSUMDB=sum.golang.org
Expand All @@ -173,34 +171,4 @@ jobs:
with:
name: backapp-server-linux-armv7
path: server/backapp-server-linux-armv7

release:
name: Publish release
needs: [build-linux-amd64, build-linux-arm64, build-raspberry-pi]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Linux amd64 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-amd64
path: artifacts

- name: Download Linux arm64 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-arm64
path: artifacts

- name: Download Linux armv7 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-armv7
path: artifacts

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
retention-days: 30
45 changes: 45 additions & 0 deletions .github/workflows/binary.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release BackApp

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build-and-test:
uses: ./.github/workflows/binary.test.yml
secrets: inherit
release:
name: Publish release
needs: build-and-test
if: ${{ needs.build-and-test.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Download Linux amd64 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-amd64
path: artifacts

- name: Download Linux arm64 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-arm64
path: artifacts

- name: Download Linux armv7 artifact
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-armv7
path: artifacts

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.workflow_run.head_branch }}
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/binary.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Test BackApp

on:
workflow_dispatch:
workflow_call:
push:
branches:
- '**'

permissions:
contents: read
checks: write

jobs:
build:
uses: ./.github/workflows/binary.build.yml
secrets: inherit
test:
name: Run Playwright Tests
needs: build
if: ${{ needs.build.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Linux amd64 binary
uses: actions/download-artifact@v4
with:
name: backapp-server-linux-amd64
path: build

- name: Rename binary for testing
run: mv build/backapp-server-linux-amd64 build/backapp-server

- name: Set executable permissions
run: chmod +x build/backapp-server

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: web/package-lock.json

- name: Install frontend dependencies
working-directory: web
run: npm ci

- name: Cache Playwright Binaries
id: cache-playwright
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('./web/package-lock.json') }}
- name: Install Playwright Browsers
if: steps.cache-playwright.outputs.cache-hit != 'true'
working-directory: ./web
run: npx playwright install --with-deps

- name: Run Playwright tests with JUnit output
working-directory: web
run: |
npm run test-ci

- name: Stop backend
if: always()
run: |
kill $(cat server/backapp.pid) || true

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: web/test-results/results.xml
check_name: E2E Tests
detailed_summary: true
- name: Upload Test Report html
uses: actions/upload-artifact@v4
if: failure()
with:
name: E2E html report
path: web/test-results/html
retention-days: 1
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"pretest": "npm run build-server",
"test": "playwright test",
"test:ui": "playwright test --ui",
"test-ci": "playwright test",
"test:report": "playwright show-report",
"lint": "eslint .",
"preview": "vite preview"
Expand Down
6 changes: 5 additions & 1 deletion web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export default defineConfig({
retries: 0,
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: [
['list'],
['html', { outputFolder: 'test-results/html', open: 'never' }],
['junit', { outputFile: 'test-results/results.xml' }]
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('')`. */
Expand Down
Loading