workflow: add new lines

This commit is contained in:
cy 2025-03-28 17:47:46 -04:00
parent 048800c0bf
commit 47e5c5cd77
Signed by: cy
SSH key fingerprint: SHA256:o/geVWV4om1QhUSkKvDQeW/eAihwnjyXkqMwrVdbuts
2 changed files with 21 additions and 0 deletions

View file

@ -3,6 +3,7 @@ on:
workflow_dispatch: workflow_dispatch:
push: push:
pull_request: pull_request:
env: env:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
NIX_CONFIG: | NIX_CONFIG: |
@ -16,6 +17,7 @@ env:
TERM: ansi TERM: ansi
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }}
jobs: jobs:
build-machines: build-machines:
strategy: strategy:
@ -27,6 +29,7 @@ jobs:
os: os:
- ubuntu-latest - ubuntu-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Maximize build disk space - name: Maximize build disk space
uses: easimon/maximize-build-space@v10 uses: easimon/maximize-build-space@v10
@ -39,8 +42,10 @@ jobs:
remove-codeql: 'true' remove-codeql: 'true'
remove-docker-images: 'true' remove-docker-images: 'true'
build-mount-path: /nix build-mount-path: /nix
- name: setup binary cache key - name: setup binary cache key
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v30 uses: cachix/install-nix-action@v30
@ -58,10 +63,12 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
- name: build - name: build
run: | run: |
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel" package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
nix build -L "$package" nix build -L "$package"
- name: cache - name: cache
if: always() if: always()
run: | run: |
@ -69,6 +76,7 @@ jobs:
nix copy -j8 \ nix copy -j8 \
--to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \
$(nix path-info --recursive --derivation "$package" |sed 's/\.drv$/.drv^*/') $(nix path-info --recursive --derivation "$package" |sed 's/\.drv$/.drv^*/')
build-homes: build-homes:
strategy: strategy:
fail-fast: false fail-fast: false
@ -80,6 +88,7 @@ jobs:
- ubuntu-latest - ubuntu-latest
# - macos-latest # - macos-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Maximize build disk space - name: Maximize build disk space
uses: easimon/maximize-build-space@v10 uses: easimon/maximize-build-space@v10
@ -92,8 +101,10 @@ jobs:
remove-codeql: 'true' remove-codeql: 'true'
remove-docker-images: 'true' remove-docker-images: 'true'
build-mount-path: /nix build-mount-path: /nix
- name: setup binary cache key - name: setup binary cache key
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v30 uses: cachix/install-nix-action@v30
@ -111,10 +122,12 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
- name: build - name: build
run: | run: |
package=".#homeConfigurations."${{ matrix.home }}".activationPackage" package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
nix build -L "$package" nix build -L "$package"
- name: cache - name: cache
if: always() if: always()
run: | run: |

View file

@ -6,6 +6,7 @@ on:
description: "package to build" description: "package to build"
required: false required: false
type: string type: string
env: env:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
NIX_CONFIG: | NIX_CONFIG: |
@ -18,6 +19,7 @@ env:
TERM: ansi TERM: ansi
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }}
jobs: jobs:
build-packages: build-packages:
strategy: strategy:
@ -31,9 +33,11 @@ jobs:
# - macos-latest # - macos-latest
# - macos-13 # - macos-13
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: setup binary cache key - name: setup binary cache key
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v30 uses: cachix/install-nix-action@v30
@ -51,15 +55,19 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
- run: nix build -L ${{ matrix.package }} - run: nix build -L ${{ matrix.package }}
- name: cache result - name: cache result
if: always() if: always()
run: | run: |
nix copy -j8 \ nix copy -j8 \
--to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \
$(nix path-info --recursive --derivation "${{ matrix.package }}" |sed 's/\.drv$/.drv^*/') $(nix path-info --recursive --derivation "${{ matrix.package }}" |sed 's/\.drv$/.drv^*/')
- name: prepare tarball to upload - name: prepare tarball to upload
run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result
- name: upload result - name: upload result
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with: