ci: run in nixos/nix container, shell-only steps
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 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.
|
||||
# Gitea Actions. Every job runs in a pinned nixos/nix container with plain shell steps only:
|
||||
# the runner image has no Node, so JavaScript actions (actions/checkout, ...) cannot run.
|
||||
# Tooling comes from devbox (nix run nixpkgs#devbox), which honours devbox.lock like local runs.
|
||||
# Release upload goes through the Gitea REST API with the built-in job token.
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
@@ -9,31 +9,39 @@ on:
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
NIX_CONFIG: "experimental-features = nix-command flakes"
|
||||
NIX_CONFIG: |
|
||||
experimental-features = nix-command flakes
|
||||
sandbox = false
|
||||
filter-syscalls = false
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: nixos/nix:2.36.0
|
||||
steps:
|
||||
- name: Prepare tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
|
||||
git --version && devbox version
|
||||
- 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
|
||||
run: cd src && devbox run test
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
container: nixos/nix:2.36.0
|
||||
steps:
|
||||
- name: Prepare tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
|
||||
- name: Checkout
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -43,8 +51,7 @@ jobs:
|
||||
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
|
||||
devbox run cross-all
|
||||
cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
||||
- name: Create release and upload assets
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user