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
|
# Gitea Actions. Every job runs in a pinned nixos/nix container with plain shell steps only:
|
||||||
# with no Node, so JavaScript actions (actions/checkout, ...) cannot run: every step here
|
# the runner image has no Node, so JavaScript actions (actions/checkout, ...) cannot run.
|
||||||
# is plain shell. Tooling comes from devbox (found on PATH, else via `nix run nixpkgs#devbox`).
|
# 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 token.
|
# Release upload goes through the Gitea REST API with the built-in job token.
|
||||||
name: ci
|
name: ci
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -9,31 +9,39 @@ on:
|
|||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NIX_CONFIG: "experimental-features = nix-command flakes"
|
NIX_CONFIG: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
sandbox = false
|
||||||
|
filter-syscalls = false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container: nixos/nix:2.36.0
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare tools
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
|
||||||
|
git --version && devbox version
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
|
||||||
git -C src checkout --detach "${{ github.sha }}"
|
git -C src checkout --detach "${{ github.sha }}"
|
||||||
- name: Probe tools
|
|
||||||
run: command -v nix devbox git curl sha256sum || true
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: cd src && devbox run test
|
||||||
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: nixos/nix:2.36.0
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare tools
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -43,8 +51,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd src
|
cd src
|
||||||
if command -v devbox >/dev/null; then dv="devbox"; else dv="nix run nixpkgs#devbox --"; fi
|
devbox run cross-all
|
||||||
$dv run cross-all
|
|
||||||
cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
|
||||||
- name: Create release and upload assets
|
- name: Create release and upload assets
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user