ci: shell-only steps, no Node/JS actions (runner is host-mode NixOS)
This commit is contained in:
@@ -1,41 +1,51 @@
|
||||
# Gitea Actions (GitHub-Actions-compatible). NOT YET RUN: untested on a real runner.
|
||||
# Assumptions:
|
||||
# - A runner labelled `ubuntu-latest` (adjust `runs-on`) with Docker/Node available for actions.
|
||||
# - Nim and zig are installed via devbox (jetify-com/devbox-install-action); the nix store is fetched from cache.nixos.org.
|
||||
# - Release upload goes through the Gitea REST API (curl) with the built-in token
|
||||
# `${{ github.token }}` (Gitea maps it to GITEA_TOKEN); the token must be allowed to write releases.
|
||||
# This avoids depending on third-party release actions that target GitHub only.
|
||||
# Gitea Actions. The runner (label ubuntu-latest) executes jobs directly on a NixOS host
|
||||
# with no Node, so JavaScript actions (actions/checkout, ...) cannot run: every step here
|
||||
# is plain shell. Tooling comes from devbox (found on PATH, else via `nix run nixpkgs#devbox`).
|
||||
# Release upload goes through the Gitea REST API with the built-in token.
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
NIX_CONFIG: "experimental-features = nix-command flakes"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: "false"
|
||||
- run: devbox run test
|
||||
- name: Checkout
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
||||
git -C src checkout --detach "${{ github.sha }}"
|
||||
- name: Probe tools
|
||||
run: command -v nix devbox git curl sha256sum || true
|
||||
- name: Test
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd src
|
||||
if command -v devbox >/dev/null; then dv="devbox"; else dv="nix run nixpkgs#devbox --"; fi
|
||||
$dv run test
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: "false"
|
||||
- name: Build all targets
|
||||
run: devbox run cross-all
|
||||
- name: Checksums
|
||||
run: cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
||||
- name: Checkout
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
||||
git -C src checkout --detach "${{ github.sha }}"
|
||||
- name: Build all targets and checksums
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd src
|
||||
if command -v devbox >/dev/null; then dv="devbox"; else dv="nix run nixpkgs#devbox --"; fi
|
||||
$dv run cross-all
|
||||
cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
||||
- name: Create release and upload assets
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
@@ -44,6 +54,7 @@ jobs:
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd src
|
||||
api="$SERVER/api/v1/repos/$REPO"
|
||||
id=$(curl -fsS -X POST "$api/releases" \
|
||||
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
|
||||
Reference in New Issue
Block a user