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.
|
# Gitea Actions. The runner (label ubuntu-latest) executes jobs directly on a NixOS host
|
||||||
# Assumptions:
|
# with no Node, so JavaScript actions (actions/checkout, ...) cannot run: every step here
|
||||||
# - A runner labelled `ubuntu-latest` (adjust `runs-on`) with Docker/Node available for actions.
|
# is plain shell. Tooling comes from devbox (found on PATH, else via `nix run nixpkgs#devbox`).
|
||||||
# - 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 with the built-in token.
|
||||||
# - 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.
|
|
||||||
name: ci
|
name: ci
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["**"]
|
branches: ["**"]
|
||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
NIX_CONFIG: "experimental-features = nix-command flakes"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: jetify-com/devbox-install-action@v0.13.0
|
run: |
|
||||||
with:
|
set -euo pipefail
|
||||||
enable-cache: "false"
|
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
||||||
- run: devbox run test
|
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:
|
release:
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: jetify-com/devbox-install-action@v0.13.0
|
run: |
|
||||||
with:
|
set -euo pipefail
|
||||||
enable-cache: "false"
|
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
||||||
- name: Build all targets
|
git -C src checkout --detach "${{ github.sha }}"
|
||||||
run: devbox run cross-all
|
- name: Build all targets and checksums
|
||||||
- name: Checksums
|
run: |
|
||||||
run: cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
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
|
- name: Create release and upload assets
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ github.token }}
|
TOKEN: ${{ github.token }}
|
||||||
@@ -44,6 +54,7 @@ jobs:
|
|||||||
TAG: ${{ github.ref_name }}
|
TAG: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
cd src
|
||||||
api="$SERVER/api/v1/repos/$REPO"
|
api="$SERVER/api/v1/repos/$REPO"
|
||||||
id=$(curl -fsS -X POST "$api/releases" \
|
id=$(curl -fsS -X POST "$api/releases" \
|
||||||
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||||
|
|||||||
Reference in New Issue
Block a user