Use hydra as CI
This commit is contained in:
parent
5d4e1d28fa
commit
b9544764bb
6 changed files with 81 additions and 208 deletions
54
.github/workflows/build-one.yml
vendored
54
.github/workflows/build-one.yml
vendored
|
@ -1,54 +0,0 @@
|
|||
name: Build a system
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
job:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NIX_CACHE_KEY:
|
||||
required: true
|
||||
AWS_CREDENTIALS:
|
||||
required: true
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Cleanup Disk
|
||||
uses: curoky/cleanup-disk-action@v2.0
|
||||
with:
|
||||
retain: ''
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= chir-rs:AnwyFacopHSkprD6aXY4/R3J9JYzTbV2rosJCBPaB28=
|
||||
experimental-features = nix-command flakes ca-derivations
|
||||
post-build-hook = ${{ github.workspace }}/scripts/post-build-hook
|
||||
substituters = https://cache.nixos.org/ https://attic.chir.rs/chir-rs
|
||||
extra-platforms = armv7l-linux aarch64-linux powerpc-linux powerpc64-linux powerpc64le-linux riscv32-linux riscv64-linux wasm32-wasi i686-linux
|
||||
sandbox = false
|
||||
- name: Download attic
|
||||
run: nix build github:DarkKirb/nix-packages#attic-client
|
||||
- name: Set up secrets
|
||||
run: nix run github:DarkKirb/nix-packages#attic-client -- login attic-server https://attic-nocdn.chir.rs/ "$ATTIC_TOKEN"
|
||||
env:
|
||||
ATTIC_TOKEN: ${{secrets.ATTIC_TOKEN}}
|
||||
- name: Build ${{ inputs.job }}
|
||||
run: |
|
||||
DRV_PATH=$(nix-instantiate -E '(import ./.).${{ inputs.job }}')
|
||||
OUT_PATH=$(nix show-derivation $DRV_PATH | jq -r ".\"$DRV_PATH\".outputs.out.path")
|
||||
NARINFO=$(echo $OUT_PATH | sed 's|/| |g' | sed 's|-| |g' | awk '{print $3}')
|
||||
if curl --output /dev/null --silent --fail "https://attic.chir.rs/chir-rs/$NARINFO.narinfo"; then
|
||||
echo "${{ inputs.job }} already built. Skipping"
|
||||
else
|
||||
nix-store -r $DRV_PATH
|
||||
fi
|
||||
env:
|
||||
NIXPKGS_ALLOW_UNFREE: 1
|
132
.github/workflows/build.yml
vendored
132
.github/workflows/build.yml
vendored
|
@ -1,132 +0,0 @@
|
|||
name: build
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
user-base-x86_64-linux:
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.base-x86_64-linux
|
||||
secrets: inherit
|
||||
user-base-aarch64-linux:
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.base-aarch64-linux
|
||||
secrets: inherit
|
||||
user-root-x86_64-linux:
|
||||
needs: user-base-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.root-x86_64-linux
|
||||
secrets: inherit
|
||||
user-root-aarch64-linux:
|
||||
needs: user-base-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.root-aarch64-linux
|
||||
secrets: inherit
|
||||
user-darkkirb-x86_64-linux:
|
||||
needs: user-base-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.darkkirb-x86_64-linux
|
||||
secrets: inherit
|
||||
user-darkkirb-aarch64-linux:
|
||||
needs: user-base-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.darkkirb-aarch64-linux
|
||||
secrets: inherit
|
||||
user-miifox-x86_64-linux:
|
||||
needs: user-base-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.miifox-x86_64-linux
|
||||
secrets: inherit
|
||||
user-miifox-aarch64-linux:
|
||||
needs: user-base-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.miifox-aarch64-linux
|
||||
secrets: inherit
|
||||
user-base-desktop-x86_64-linux:
|
||||
needs: user-base-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.base-desktop-x86_64-linux
|
||||
secrets: inherit
|
||||
user-base-desktop-aarch64-linux:
|
||||
needs: user-base-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.base-desktop-aarch64-linux
|
||||
secrets: inherit
|
||||
user-darkkirb-desktop-x86_64-linux:
|
||||
needs: user-base-desktop-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.darkkirb-desktop-x86_64-linux
|
||||
secrets: inherit
|
||||
user-darkkirb-desktop-aarch64-linux:
|
||||
needs: user-base-desktop-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: homeConfigurations.darkkirb-desktop-aarch64-linux
|
||||
secrets: inherit
|
||||
base-server-x86_64:
|
||||
needs:
|
||||
- user-root-x86_64-linux
|
||||
- user-darkkirb-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.server-x86_64.x86_64-linux
|
||||
secrets: inherit
|
||||
base-server-aarch64:
|
||||
needs:
|
||||
- user-root-aarch64-linux
|
||||
- user-darkkirb-aarch64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.server-aarch64.aarch64-linux
|
||||
secrets: inherit
|
||||
base-desktop-x86_64:
|
||||
needs:
|
||||
- user-root-x86_64-linux
|
||||
- user-darkkirb-desktop-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.desktop-x86_64.x86_64-linux
|
||||
secrets: inherit
|
||||
nas:
|
||||
needs: base-server-x86_64
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.nas.x86_64-linux
|
||||
secrets: inherit
|
||||
nixos-8gb-fsn1-1:
|
||||
needs:
|
||||
- base-server-x86_64
|
||||
- user-miifox-x86_64-linux
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.nixos-8gb-fsn1-1.x86_64-linux
|
||||
secrets: inherit
|
||||
nutty-noon:
|
||||
needs: base-desktop-x86_64
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.nutty-noon.x86_64-linux
|
||||
secrets: inherit
|
||||
thinkrac:
|
||||
needs: base-desktop-x86_64
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.thinkrac.x86_64-linux
|
||||
secrets: inherit
|
||||
instance-20221213-1915:
|
||||
needs: base-server-aarch64
|
||||
uses: ./.github/workflows/build-one.yml
|
||||
with:
|
||||
job: hydraJobs.instance-20221213-1915.aarch64-linux
|
||||
secrets: inherit
|
22
.github/workflows/build_install_iso.yml
vendored
22
.github/workflows/build_install_iso.yml
vendored
|
@ -1,22 +0,0 @@
|
|||
name: Build installer iso
|
||||
on:
|
||||
schedule:
|
||||
- cron: "45 14 * * 1"
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build-install-iso:
|
||||
name: Build installer iso
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: nixos-config/nixos-config/installer.x86_64-linux
|
||||
- uses: cachix/install-nix-action@v17
|
||||
with:
|
||||
extra_nix_config: |
|
||||
substituters = https://f000.backblazeb2.com/file/cache-chir-rs/ https://cache.nixos.org/
|
||||
trusted-public-keys = nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=
|
||||
- run: nix build '.#nixosConfigurations.installer.config.system.build.isoImage'
|
||||
- run: wget https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc
|
||||
- run: ./mc alias set b2 https://s3.us-west-000.backblazeb2.com ${{ secrets.B2_ACCESS_KEY_ID }} ${{ secrets.B2_SECRET_ACCESS_KEY }}
|
||||
- run: ./mc cp result/iso/*.iso b2/cache-chir-rs/installer.iso
|
1
hydra/default.nix
Normal file
1
hydra/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{nixos-config}: (import nixos-config).hydraJobs
|
51
hydra/jobsets.nix
Normal file
51
hydra/jobsets.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
prsJSON,
|
||||
nixpkgs,
|
||||
}: let
|
||||
pkgs = import nixpkgs {};
|
||||
prs = builtins.fromJSON (builtins.readFile prsJSON);
|
||||
|
||||
jobsets =
|
||||
pkgs.lib.mapAttrs (num: info:
|
||||
{
|
||||
enabled = 1;
|
||||
hidden = false;
|
||||
description = "PR ${num}: ${info.title}";
|
||||
nixexprinput = "nixos-config";
|
||||
nixexprpath = "hydra/default.nix";
|
||||
checkinterval = 300;
|
||||
schedulingshares = 100;
|
||||
enableemail = false;
|
||||
emailoverride = "";
|
||||
keepnr = 1;
|
||||
inputs = {
|
||||
nixos-config = {
|
||||
type = "git";
|
||||
value = "https://github.com/${info.head.repo.owner.login}/${info.head.repo.name}.git ${info.head.ref}";
|
||||
emailresponsible = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
prs)
|
||||
// {
|
||||
nixos-config = {
|
||||
enabled = 1;
|
||||
hidden = false;
|
||||
description = "Current nixos config";
|
||||
nixexprinput = "nixos-config";
|
||||
nixexprpath = "hydra/default.nix";
|
||||
checkinterval = 300;
|
||||
schedulingshares = 100;
|
||||
enableemail = false;
|
||||
emailoverride = "";
|
||||
keepnr = 1;
|
||||
inputs = {
|
||||
nixos-config = {
|
||||
type = "git";
|
||||
value = "https://github.com/DarkKirb/nixos-config.git main";
|
||||
emailresponsible = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);}
|
29
hydra/spec.json
Normal file
29
hydra/spec.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "jobsets",
|
||||
"nixexprinput": "nixos-config",
|
||||
"nixexprpath": "hydra/jobsets.nix",
|
||||
"checkinterval": 60,
|
||||
"schedulingshares": 100,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 1,
|
||||
"inputs": {
|
||||
"nixos-config": {
|
||||
"type": "git",
|
||||
"value": "https://github.com/DarkKirb/nixos-config.git switch-to-hydra",
|
||||
"emailresponsible": false
|
||||
},
|
||||
"nixpkgs": {
|
||||
"type": "git",
|
||||
"value": "https://github.com/NixOS/nixpkgs.git",
|
||||
"emailresponsible": false
|
||||
},
|
||||
"prsJSON": {
|
||||
"type": "githubpulls",
|
||||
"value": "DarkKirb nixos-config",
|
||||
"emailresponsible": false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue