From db0080a827db043f1369aa3fc43e72a3656f9b74 Mon Sep 17 00:00:00 2001 From: rina Date: Thu, 14 Sep 2023 16:38:07 +1000 Subject: [PATCH] fix schedule? --- .github/workflows/main.yml | 18 +++++++++ .github/workflows/nix.yml | 72 ++++++++++++++++++++++++++++------- .github/workflows/setup.yml | 18 --------- .github/workflows/upgrade.yml | 48 ----------------------- 4 files changed, 76 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/setup.yml delete mode 100644 .github/workflows/upgrade.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a988d47 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: "build Nix packages" +on: + pull_request: + push: + schedule: + - cron: '53 20 * * *' # AEST 6:53 am + workflow_dispatch: +jobs: + nix: + strategy: + matrix: + pkg: [aslp, bap-aslp, basil, bap-uq-pac] + runs-on: ubuntu-latest + uses: ./github/workflows/upgrade.yml@main + with: + pkg: ${{matrix.pkg}} + secrets: inherit + diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index a988d47..f4b3096 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -1,18 +1,62 @@ -name: "build Nix packages" +name: "update and check Nix packages" on: - pull_request: - push: - schedule: - - cron: '53 20 * * *' # AEST 6:53 am - workflow_dispatch: + workflow_call: + inputs: + pkg: { required: true, type: string } jobs: - nix: - strategy: - matrix: - pkg: [aslp, bap-aslp, basil, bap-uq-pac] + check: runs-on: ubuntu-latest - uses: ./github/workflows/upgrade.yml@main - with: - pkg: ${{matrix.pkg}} - secrets: inherit + 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 ./update-shell.nix + - run: | + nix-shell ./update-shell.nix --pure \ + --run './update.py check -A ${{inputs.pkg}}' + + do-upgrade: + if: | + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + && contains('schedule workflow_dispatch', github.event_name) + concurrency: do-upgrade # one package upgrade in-flight at a time + runs-on: ubuntu-latest + needs: check + 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 ./update-shell.nix + - 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 --pure \ + --run './update.py do-upgrade -A ${{inputs.pkg}}' + - run: git push + + build: + runs-on: ubuntu-latest + needs: do-upgrade + 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 + diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index f6b1bb4..0000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: "common runner setup" -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: true -jobs: - setup: - 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 }}' diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml deleted file mode 100644 index 576e395..0000000 --- a/.github/workflows/upgrade.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: "update and check Nix packages" -on: - workflow_call: - inputs: - pkg: { required: true, type: string } -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: ./.github/workflows/setup.yml@main - secrets: inherit - - run: nix-build ./update-shell.nix - - run: | - nix-shell ./update-shell.nix --pure \ - --run './update.py check -A ${{inputs.pkg}}' - - do-upgrade: - if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) - concurrency: do-upgrade # one package upgrade in-flight at a time - runs-on: ubuntu-latest - needs: check - steps: - - uses: ./.github/workflows/setup.yml@main - secrets: inherit - - run: nix-build ./update-shell.nix - - 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 --pure \ - --run './update.py do-upgrade -A ${{inputs.pkg}}' - - run: git push - - build: - runs-on: ubuntu-latest - needs: do-upgrade - steps: - - uses: ./.github/workflows/setup.yml@main - secrets: inherit - - 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 - -