Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5492dd8cf1 | ||
|
|
d1d5ac8f98 |
@@ -17,9 +17,12 @@ env:
|
||||
REGISTRY_OWNER: sansan
|
||||
|
||||
jobs:
|
||||
# cmd/api and cmd/tui are pure Go (no cgo), so they cross-compile cleanly
|
||||
# from one Linux runner for every OS/arch below.
|
||||
build-go:
|
||||
# cmd/api isn't built here: the Docker image (build-docker below) is the
|
||||
# distribution path for the server, so a standalone api binary would
|
||||
# just be a redundant artifact nobody runs directly. cmd/tui is a real
|
||||
# CLI people run on their own machine, and it's pure Go (no cgo), so it
|
||||
# cross-compiles cleanly from one Linux runner for every OS/arch below.
|
||||
build-tui:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -41,7 +44,14 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Build api and tui
|
||||
# Built with its final release filename directly (rather than a
|
||||
# generic name plus a separate archive step), so what comes out of
|
||||
# dist/ is exactly what gets uploaded: a raw executable, no
|
||||
# zip/tar.gz. One real trade-off: a raw upload doesn't preserve the
|
||||
# Unix executable bit the way a tar.gz would, so linux/darwin
|
||||
# downloads need a manual `chmod +x` before running; .exe is
|
||||
# unaffected.
|
||||
- name: Build tui
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
@@ -50,26 +60,15 @@ jobs:
|
||||
mkdir -p dist
|
||||
ext=""
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then ext=".exe"; fi
|
||||
go build -o "dist/completed-api${ext}" ./cmd/api
|
||||
go build -o "dist/completed-tui${ext}" ./cmd/tui
|
||||
|
||||
- name: Archive
|
||||
run: |
|
||||
cd dist
|
||||
base="${PROJECT_NAME}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
zip "../${base}.zip" completed-api.exe completed-tui.exe
|
||||
else
|
||||
tar czf "../${base}.tar.gz" completed-api completed-tui
|
||||
fi
|
||||
go build -o "dist/${PROJECT_NAME}-tui_${{ matrix.goos }}_${{ matrix.goarch }}${ext}" ./cmd/tui
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PROJECT_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
path: ${{ env.PROJECT_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}.*
|
||||
name: ${{ env.PROJECT_NAME }}-tui_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
path: dist/*
|
||||
retention-days: 7
|
||||
|
||||
# cmd/gui (Fyne) uses cgo, so unlike build-go above it can't just cross-
|
||||
# cmd/gui (Fyne) uses cgo, so unlike build-tui above it can't just cross-
|
||||
# compile with CGO_ENABLED=0. Linux is native to this runner; Windows
|
||||
# cross-compiles cleanly with the mingw-w64 toolchain (verified locally:
|
||||
# a real PE32+ GUI-subsystem .exe, linking Fyne's OpenGL/glfw backend,
|
||||
@@ -100,6 +99,8 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.packages }}
|
||||
|
||||
# Same reasoning as build-tui above: upload the raw executable, built
|
||||
# with its final release name directly, no archive step.
|
||||
- name: Build gui
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
@@ -107,26 +108,17 @@ jobs:
|
||||
CGO_ENABLED: "1"
|
||||
run: |
|
||||
mkdir -p dist
|
||||
name="dist/${PROJECT_NAME}-gui_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
CC=x86_64-w64-mingw32-gcc go build -ldflags "-H=windowsgui" -o dist/completed-gui.exe ./cmd/gui
|
||||
CC=x86_64-w64-mingw32-gcc go build -ldflags "-H=windowsgui" -o "${name}.exe" ./cmd/gui
|
||||
else
|
||||
go build -o dist/completed-gui ./cmd/gui
|
||||
fi
|
||||
|
||||
- name: Archive
|
||||
run: |
|
||||
cd dist
|
||||
base="../${PROJECT_NAME}-gui_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
zip "${base}.zip" completed-gui.exe
|
||||
else
|
||||
tar czf "${base}.tar.gz" completed-gui
|
||||
go build -o "${name}" ./cmd/gui
|
||||
fi
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PROJECT_NAME }}-gui_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
path: ${{ env.PROJECT_NAME }}-gui_${{ matrix.goos }}_${{ matrix.goarch }}.*
|
||||
path: dist/*
|
||||
retention-days: 7
|
||||
|
||||
build-web:
|
||||
@@ -188,7 +180,7 @@ jobs:
|
||||
${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}/completed:latest
|
||||
|
||||
release:
|
||||
needs: [build-go, build-gui, build-web]
|
||||
needs: [build-tui, build-gui, build-web]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
|
||||
Reference in new issue
Block a user