Compare commits
No commits in common. "9d57a36ace80c48830318235ecf6ccea85059a94" and "4291f26f4e8a55ccb901fcb4db42b089e48d361a" have entirely different histories.
9d57a36ace
...
4291f26f4e
1 changed files with 22 additions and 64 deletions
|
@ -1,18 +1,12 @@
|
||||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
||||||
name: "Build"
|
name: "Build"
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: ["main"]
|
||||||
- main
|
paths: [".forgejo/workflows/build.yaml"]
|
||||||
paths:
|
# schedule every night
|
||||||
- ".forgejo/workflows/build.yaml"
|
schedule:
|
||||||
- "flake.lock"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-build:
|
nix-build:
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
|
@ -26,8 +20,6 @@ jobs:
|
||||||
os: native-x86_64
|
os: native-x86_64
|
||||||
- system: gandalf
|
- system: gandalf
|
||||||
os: native-x86_64
|
os: native-x86_64
|
||||||
- system: telperion
|
|
||||||
os: native-x86_64
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
PATH: ${{ format('{0}:{1}', '/run/current-system/sw/bin', env.PATH) }}
|
PATH: ${{ format('{0}:{1}', '/run/current-system/sw/bin', env.PATH) }}
|
||||||
|
@ -36,65 +28,31 @@ jobs:
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up Cachix
|
- uses: https://github.com/cachix/cachix-action@v15
|
||||||
uses: https://github.com/cachix/cachix-action@v15
|
|
||||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||||
with:
|
with:
|
||||||
name: hsndev
|
name: hsndev
|
||||||
|
# If you chose API tokens for write access OR if you have a private cache
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
# env:
|
||||||
|
# USER: 'root'
|
||||||
|
|
||||||
- name: Garbage collect build dependencies
|
- name: Garbage collect build dependencies
|
||||||
run: nix-collect-garbage
|
run: nix-collect-garbage
|
||||||
|
|
||||||
- name: Build previous ${{ matrix.system }} system
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
nix build git+https://git.hsn.dev/jahanson/mochi#top.${{ matrix.system }} \
|
|
||||||
-v --log-format raw --profile ./profile
|
|
||||||
- name: Build new ${{ matrix.system }} system
|
- name: Build new ${{ matrix.system }} system
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
nix build ".#top.${{ matrix.system }}" --profile ./profile --fallback -v \
|
set -o pipefail
|
||||||
> >(tee stdout.log) 2> >(tee /tmp/nix-build-err.log >&2)
|
nix build \
|
||||||
- name: Check for build failure
|
".#top.${{ matrix.system }}" \
|
||||||
if: failure()
|
--profile ./profile \
|
||||||
run: |
|
--fallback \
|
||||||
drv=$(grep "For full logs, run" /tmp/nix-build-err.log | grep -oE "/nix/store/.*.drv")
|
-v \
|
||||||
if [ -n $drv ]; then
|
--log-format raw \
|
||||||
nix log $drv
|
> >(tee stdout.log) 2> >(tee /tmp/nix-build-err.log >&2)
|
||||||
echo $drv
|
- name: Push to Cachix
|
||||||
fi
|
if: success()
|
||||||
exit 1
|
env:
|
||||||
- name: Diff profile
|
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||||
id: diff
|
run: nix build ".#top.${{ matrix.system }}" --json | jq -r .[].drvPath | cachix push hsndev
|
||||||
run: |
|
|
||||||
nix profile diff-closures --profile ./profile
|
|
||||||
delimiter="$(openssl rand -hex 16)"
|
|
||||||
echo "diff<<${delimiter}" >> "${GITHUB_OUTPUT}"
|
|
||||||
nix profile diff-closures --profile ./profile | perl -pe 's/\e\[[0-9;]*m(?:\e\[K)?//g' >> "${GITHUB_OUTPUT}"
|
|
||||||
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
|
|
||||||
- name: Comment report in pr
|
|
||||||
uses: https://github.com/marocchino/sticky-pull-request-comment@v2
|
|
||||||
with:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
header: ".#top.${{ matrix.system }}"
|
|
||||||
message: |
|
|
||||||
### Report for `${{ matrix.system }}`
|
|
||||||
|
|
||||||
<summary> Version changes </summary> <br>
|
|
||||||
<pre> ${{ steps.diff.outputs.diff }} </pre>
|
|
||||||
# - name: Push to Cachix
|
|
||||||
# if: success()
|
|
||||||
# env:
|
|
||||||
# CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
|
||||||
# run: nix build ".#top.${{ matrix.system }}" --json | jq -r .[].drvPath | cachix push hsndev
|
|
||||||
nix-build-success:
|
|
||||||
if: ${{ always() }}
|
|
||||||
needs:
|
|
||||||
- nix-build
|
|
||||||
name: Nix Build Successful
|
|
||||||
runs-on: docker
|
|
||||||
steps:
|
|
||||||
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
|
|
||||||
name: Check matrix status
|
|
||||||
run: exit 1
|
|
||||||
|
|
Loading…
Reference in a new issue