ci: move CI tasks into Nushell scripts and update dependencies weekly
Replace the shell scripts in flake.nix with Nushell scripts in ci/, exposed as flake apps in nix/ci-tasks.nix, so every workflow command is a plain nix call. Build the workspace dependencies in a step of their own, upload to Cachix only after the builds, and run the formatting check through the pre-commit hooks. Automated pushes, tags and pull requests now use the wvhulle-bot account. A weekly cron updates Cargo.lock and flake.lock and opens or updates one pull request from bot/dependency-updates. Claude-Session: https://claude.ai/code/session_01D8dLLgYd8cfR2aQfA5eZXa
This commit is contained in:
11 files changed
+519
-173
No files matched your search
@@ -0,0 +1,85 @@
|
||||
when:
|
||||
- repo: wvhulle/bootvine
|
||||
event: [pull_request, push, manual]
|
||||
|
||||
variables:
|
||||
- &nix_config
|
||||
NIX_CONFIG: |
|
||||
experimental-features = nix-command flakes
|
||||
build-users-group =
|
||||
accept-flake-config = true
|
||||
- &after_dependency_step
|
||||
- status: [success, failure]
|
||||
|
||||
steps:
|
||||
- name: prepare-build-dependencies
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#build-unless-cached -- .#packages.x86_64-linux.workspace-dependencies
|
||||
|
||||
- name: build-and-test-bootvine
|
||||
image: nixos/nix:latest
|
||||
depends_on: [prepare-build-dependencies]
|
||||
when: *after_dependency_step
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.bootvine-build
|
||||
|
||||
- name: build-repo-tasks
|
||||
image: nixos/nix:latest
|
||||
depends_on: [prepare-build-dependencies]
|
||||
when: *after_dependency_step
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix run --quiet .#build-and-export-paths -- .#checks.x86_64-linux.repo-tasks-build
|
||||
|
||||
- name: lint-with-clippy
|
||||
image: nixos/nix:latest
|
||||
depends_on: [prepare-build-dependencies]
|
||||
when: *after_dependency_step
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#import-exported-paths
|
||||
- nix build --quiet --print-build-logs .#checks.x86_64-linux.clippy-lints
|
||||
|
||||
- name: upload-builds-to-cachix
|
||||
image: nixos/nix:latest
|
||||
depends_on: [build-and-test-bootvine, build-repo-tasks]
|
||||
when:
|
||||
- event: [push, manual]
|
||||
branch: main
|
||||
status: [success, failure]
|
||||
environment:
|
||||
<<: *nix_config
|
||||
CACHIX_AUTH_TOKEN:
|
||||
from_secret: cachix_auth_token
|
||||
commands:
|
||||
- nix run --quiet .#upload-exported-paths
|
||||
|
||||
- name: run-pre-commit-hooks
|
||||
image: nixos/nix:latest
|
||||
depends_on: [prepare-build-dependencies]
|
||||
when: *after_dependency_step
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#run-pre-commit-hooks
|
||||
|
||||
- name: evaluate-flake-outputs
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix flake check --quiet --no-build
|
||||
|
||||
- name: check-commit-messages
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when:
|
||||
- event: pull_request
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix run --quiet .#check-commit-messages -- --fetch-target-branch FETCH_HEAD..HEAD
|
||||
@@ -0,0 +1,28 @@
|
||||
when:
|
||||
- repo: wvhulle/bootvine
|
||||
event: cron
|
||||
cron: weekly-dependency-update
|
||||
|
||||
clone:
|
||||
- name: clone-with-history
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
depth: 0
|
||||
partial: false
|
||||
|
||||
steps:
|
||||
- name: open-dependency-update-pr
|
||||
image: nixos/nix:latest
|
||||
environment:
|
||||
NIX_CONFIG: |
|
||||
experimental-features = nix-command flakes
|
||||
build-users-group =
|
||||
accept-flake-config = true
|
||||
GIT_AUTHOR_NAME: wvhulle-bot
|
||||
GIT_AUTHOR_EMAIL: willemvanhulle@protonmail.com
|
||||
GIT_COMMITTER_NAME: wvhulle-bot
|
||||
GIT_COMMITTER_EMAIL: willemvanhulle@protonmail.com
|
||||
CODEBERG_TOKEN:
|
||||
from_secret: bot_token
|
||||
commands:
|
||||
- nix run --quiet .#open-dependency-update-pr -- --cargo-lock --flake-lock
|
||||
+7
-9
@@ -4,10 +4,10 @@ when:
|
||||
branch: main
|
||||
|
||||
depends_on:
|
||||
- rust-and-flake-checks
|
||||
- checks
|
||||
|
||||
clone:
|
||||
- name: clone-with-history-and-tags
|
||||
- name: clone-with-history
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
depth: 0
|
||||
@@ -25,21 +25,19 @@ variables:
|
||||
GIT_COMMITTER_NAME: release-plz
|
||||
GIT_COMMITTER_EMAIL: willemvanhulle@protonmail.com
|
||||
CODEBERG_TOKEN:
|
||||
from_secret: codeberg_token
|
||||
from_secret: bot_token
|
||||
CARGO_REGISTRY_TOKEN:
|
||||
from_secret: cargo_registry_token
|
||||
|
||||
steps:
|
||||
- name: publish-crate-and-tag-release
|
||||
- name: publish-unreleased-crate-version
|
||||
image: nixos/nix:latest
|
||||
environment: *release_env
|
||||
commands:
|
||||
- git remote set-url origin "https://wvhulle:$${CODEBERG_TOKEN}@codeberg.org/$${CI_REPO}.git"
|
||||
- git checkout -B main "$${CI_COMMIT_SHA}"
|
||||
- nix run .#release-plz-release
|
||||
- nix run --quiet .#publish-unreleased-crate-version
|
||||
|
||||
- name: update-release-pr
|
||||
- name: open-or-update-release-pr
|
||||
image: nixos/nix:latest
|
||||
environment: *release_env
|
||||
commands:
|
||||
- nix run .#release-plz-release-pr
|
||||
- nix run --quiet .#open-or-update-release-pr
|
||||
@@ -1,87 +0,0 @@
|
||||
when:
|
||||
- repo: wvhulle/bootvine
|
||||
event: [pull_request, push, manual]
|
||||
|
||||
variables:
|
||||
- &nix_config
|
||||
NIX_CONFIG: |
|
||||
experimental-features = nix-command flakes
|
||||
build-users-group =
|
||||
accept-flake-config = true
|
||||
- &cache_writing_env
|
||||
<<: *nix_config
|
||||
CACHIX_AUTH_TOKEN:
|
||||
from_secret: cachix_auth_token
|
||||
- &on_main_branch
|
||||
- event: [push, manual]
|
||||
branch: main
|
||||
- &off_main_branch
|
||||
- event: pull_request
|
||||
- event: [push, manual]
|
||||
branch:
|
||||
exclude: main
|
||||
- &on_pull_requests
|
||||
- event: pull_request
|
||||
|
||||
steps:
|
||||
- name: build-test-and-cache-bootvine
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *on_main_branch
|
||||
environment: *cache_writing_env
|
||||
commands:
|
||||
- nix run .#build-and-push-to-cachix -- .#checks.x86_64-linux.bootvine-build
|
||||
|
||||
- name: build-and-test-bootvine
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *off_main_branch
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.bootvine-build
|
||||
|
||||
- name: build-and-cache-repo-tasks
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *on_main_branch
|
||||
environment: *cache_writing_env
|
||||
commands:
|
||||
- nix run .#build-and-push-to-cachix -- .#checks.x86_64-linux.repo-tasks-build
|
||||
|
||||
- name: build-repo-tasks
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *off_main_branch
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.repo-tasks-build
|
||||
|
||||
- name: lint-rust-with-clippy
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.clippy-lints
|
||||
|
||||
- name: check-rust-formatting
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix build --print-build-logs .#checks.x86_64-linux.rustfmt-formatting
|
||||
|
||||
- name: evaluate-flake-outputs
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- nix flake check --no-build
|
||||
|
||||
- name: check-conventional-commit-messages
|
||||
image: nixos/nix:latest
|
||||
depends_on: []
|
||||
when: *on_pull_requests
|
||||
environment: *nix_config
|
||||
commands:
|
||||
- git fetch --quiet origin "$${CI_COMMIT_TARGET_BRANCH}"
|
||||
- nix run .#check-conventional-commits -- FETCH_HEAD..HEAD
|
||||
Reference in new issue
Block a user