Skip to content

flake update

flake update #343

Workflow file for this run

name: rebuilds
on: [pull_request]
jobs:
# Calculate changed derivations
get-changed-derivs:
name: Get changed derivations
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
# Pull from the cachix cache
- uses: cachix/cachix-action@v12
with:
name: nix-qchem
# Checkout of the current head in the working dir
- uses: actions/checkout@v3
# Get PR target branch checkout
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
repository: ${{ github.event.pull_request.base.repo.full_name }}
path: pr_base
# Get a checkout of this PR
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
path: pr_head
- name: Calculate changed derivations and upload as artifacts
run: nix eval --impure --expr 'import ./.github/workflows/changedPaths.nix ./pr_head ./pr_base' --json | tee chDerivs.json
# Upload JSON of the changed derivations
- uses: actions/upload-artifact@v3
with:
name: Changed-Derivations
path: chDerivs.json
retention-days: 1
# Rebuild changed derivations for the pinned snapshot
rebuild-head:
name: Changed derivations HEAD (pinned nixpkgs)
needs: get-changed-derivs
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v20
# Pull from the cachix cache
- uses: cachix/cachix-action@v12
with:
name: nix-qchem
# Checkout of the current head in the working dir
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
# Get changed derivations as artifact from previous step
- uses: actions/download-artifact@v3
with:
name: Changed-Derivations
- name: Rebuild python3 packages
run: |
if [ -n "$(jq '.python3[]' chDerivs.json)" ]; then
nix build --accept-flake-config --print-build-logs $(for p in $(jq '.python3[]' chDerivs.json | tr -d "\""); do echo ".#python3.pkgs.${p}"; done)
fi
- name: Rebuild all top-level packages
run: |
if [ -n "$(jq '.topLevel[]' chDerivs.json)" ]; then
nix build --accept-flake-config --print-build-logs $(for p in $(jq '.topLevel[]' chDerivs.json | tr -d "\""); do echo ".#${p}"; done)
fi
# Rebuild changed derivations as if merged
rebuild-merge:
name: Changed Derivations Merge (pinned nixpkgs)
needs: get-changed-derivs
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v20
# Pull from the cachix cache
- uses: cachix/cachix-action@v12
with:
name: nix-qchem
# Checkout merge commit as if PR would already be merged
- uses: actions/checkout@v3
# Get changed derivations as artifact from previous step
- uses: actions/download-artifact@v3
with:
name: Changed-Derivations
- name: Rebuild all changed python3 packages
run: |
if [ -n "$(jq '.python3[]' chDerivs.json)" ]; then
nix build --accept-flake-config --print-build-logs $(for p in $(jq '.python3[]' chDerivs.json | tr -d "\""); do echo ".#python3.pkgs.${p}"; done)
fi
- name: Rebuild all changed top-level packages
run: |
if [ -n "$(jq '.topLevel[]' chDerivs.json)" ]; then
nix build --accept-flake-config --print-build-logs $(for p in $(jq '.topLevel[]' chDerivs.json | tr -d "\""); do echo ".#${p}"; done)
fi