Skip to content

Commit

Permalink
add daily automatic upgrades.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Sep 14, 2023
1 parent 0e67fdb commit 260e639
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 34 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
workflow_call:
inputs:
pkg: { required: true, type: string }
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with: { nix_path: 'nixpkgs=channel:nixos-unstable' }
- uses: cachix/cachix-action@v12
with: { name: pac-nix, authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' }

- run: nix-build -A ${{inputs.pkg}}
- name: nix-build -A ${{inputs.pkg}}.tests -o result-tests
run: |
if nix-instantiate --eval -A ${{inputs.pkg}}.tests; then
nix-build -A ${{inputs.pkg}}.tests -o result-tests
fi
- run: ls -l

34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "build Nix packages"
on:
pull_request:
push:
schedule:
- cron: '53 20 * * *' # AEST 6:53 am
workflow_dispatch:
jobs:
sources:
if: |
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
&& contains('schedule workflow_dispatch', github.event_name)
strategy:
fail-fast: false
max-parallel: 1
matrix:
pkg: [asli, bap-asli-plugin, bap-uq-pac, basil]
uses: ./.github/workflows/nix.yml
with:
pkg: ${{matrix.pkg}}
secrets: inherit

tools:
needs: sources
if: ${{ !cancelled() }}
strategy:
fail-fast: false
matrix:
pkg: [aslp, bap-aslp, bap-uq-pac, basil]
uses: ./.github/workflows/build.yml
with:
pkg: ${{matrix.pkg}}
secrets: inherit

51 changes: 18 additions & 33 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
name: "Build Nix packages"
on:
pull_request:
push:
schedule:
- cron: '53 21 * * *' # AEST 7:53 am
workflow_call:
inputs:
pkg: { required: true, type: string }
jobs:
nix:
strategy:
matrix:
pkg: [aslp, bap-aslp, basil, bap-uq-pac]
upgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
with: { nix_path: 'nixpkgs=channel:nixos-unstable' }
- uses: cachix/cachix-action@v12
with:
name: pac-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-build -A ${{matrix.pkg}}
- name: nix-build -A ${{matrix.pkg}}.tests -o result-tests
run: |
if nix-instantiate --eval -A ${{matrix.pkg}}.tests; then
nix-build -A ${{matrix.pkg}}.tests -o result-tests
fi
- run: ls -l
update-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: pac-nix
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: ./update.sh check
with: { name: pac-nix, authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' }

- run: nix-build ./update-shell.nix
- run: |
nix-shell ./update-shell.nix --run './update.py check -A ${{inputs.pkg}}'
- run: |
git config user.name 'github-actions[bot]'
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- run: |
nix-shell ./update-shell.nix --run './update.py do-upgrade -A ${{inputs.pkg}}'
- run: git push

2 changes: 1 addition & 1 deletion update.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def upgrade(p: Package, args: Args):

if args.mode == 'do-upgrade':
args.mode = 'upgrade'
args.rest = ['--build', '--test', '--commit'] + args.rest
args.rest = ['--build', '--commit'] + args.rest

for f in fields(Args):
assert f.name in args, f.name
Expand Down

0 comments on commit 260e639

Please sign in to comment.