109 lines
3.9 KiB
YAML
109 lines
3.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags: ['*']
|
|
|
|
jobs:
|
|
nix-build:
|
|
runs-on: orion-lxc
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
rm -rf ./* ./.[!.]* 2>/dev/null || true
|
|
REF="${{ gitea.ref_name }}"
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
REF=dev
|
|
fi
|
|
git clone --branch "$REF" \
|
|
"${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
|
test -f flake.nix
|
|
git log --oneline -1
|
|
|
|
- name: Inspect workspace
|
|
run: |
|
|
pwd
|
|
ls -la
|
|
git rev-parse --show-toplevel 2>&1 || true
|
|
git remote -v 2>&1 || true
|
|
git describe --tags --always 2>&1 || true
|
|
test -f flake.nix && echo "flake.nix present" || echo "NO flake.nix"
|
|
|
|
- name: Compute version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "APP_VERSION=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
|
else
|
|
echo "APP_VERSION=$(git describe --tags --always)" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
# ---- x86_64 (native) ----
|
|
- name: Build package (x86_64)
|
|
run: |
|
|
nix build -L ".#packages.$(nix eval --impure --raw --expr 'builtins.currentSystem').default" \
|
|
--impure --out-link result-pkg
|
|
|
|
- name: Build + offline test suite (x86_64)
|
|
run: |
|
|
nix build -L ".#checks.$(nix eval --impure --raw --expr 'builtins.currentSystem').default" \
|
|
--impure --out-link result-checks
|
|
|
|
- name: Live portal tests
|
|
env:
|
|
RWT_LIVE_ACCOUNT_EMAIL: ${{ secrets.RWT_LIVE_ACCOUNT_EMAIL }}
|
|
RWT_LIVE_LICENSE_EMAIL: ${{ secrets.RWT_LIVE_LICENSE_EMAIL }}
|
|
RWT_LIVE_LICENSE_KEY: ${{ secrets.RWT_LIVE_LICENSE_KEY }}
|
|
run: |
|
|
nix develop --command bash -c '
|
|
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
|
cmake --build build --target test_api_client test_license_service
|
|
./build/test_api_client
|
|
./build/test_license_service
|
|
'
|
|
|
|
# ---- aarch64 (emulated via host binfmt_misc/qemu-user) ----
|
|
- name: Build package (aarch64)
|
|
run: |
|
|
nix build -L ".#packages.aarch64-linux.default" \
|
|
--impure --out-link result-pkg-aarch64
|
|
|
|
- name: Build + offline test suite (aarch64)
|
|
run: |
|
|
nix build -L ".#checks.aarch64-linux.default" \
|
|
--impure --out-link result-checks-aarch64
|
|
|
|
# ---- Publish (only reached if every build/test above passed) ----
|
|
- name: Push to Attic dev cache
|
|
if: github.event_name == 'workflow_dispatch'
|
|
env:
|
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN_DEV }}
|
|
run: |
|
|
attic login radiantwave https://attic.radiantwavetech.com "$ATTIC_TOKEN"
|
|
attic push radiantwave:radiantwave-dev ./result-pkg ./result-pkg-aarch64
|
|
|
|
- name: Push to Attic release cache
|
|
if: github.event_name != 'workflow_dispatch'
|
|
env:
|
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN_PROD }}
|
|
run: |
|
|
attic login radiantwave https://attic.radiantwavetech.com "$ATTIC_TOKEN"
|
|
attic push radiantwave:radiantwave ./result-pkg ./result-pkg-aarch64
|
|
|
|
- name: Publish manifests
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
DEST=radiantwave-dev
|
|
else
|
|
DEST=radiantwave
|
|
fi
|
|
|
|
X86_PATH=$(readlink -f ./result-pkg)
|
|
ARM_PATH=$(readlink -f ./result-pkg-aarch64)
|
|
|
|
printf '{"version":"%s","storePath":"%s"}\n' "${{ env.APP_VERSION }}" "$X86_PATH" > manifest.json
|
|
printf '{"version":"%s","storePath":"%s"}\n' "${{ env.APP_VERSION }}" "$ARM_PATH" > aarch64-manifest.json
|
|
cat manifest.json aarch64-manifest.json
|
|
|
|
scp manifest.json aarch64-manifest.json \
|
|
nclack@157.245.124.103:/mnt/infrastructure_data/files/$DEST/ |