2020-04-08 16:39:06 +12:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2023-07-10 07:20:29 -05:00
|
|
|
merge_group:
|
2023-11-09 18:02:57 +13:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "master"
|
2020-04-08 16:39:06 +12:00
|
|
|
|
2022-12-18 11:37:07 -05:00
|
|
|
concurrency:
|
2024-05-02 09:56:25 -04:00
|
|
|
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
|
|
|
|
cancel-in-progress: true
|
2022-12-18 11:37:07 -05:00
|
|
|
|
2020-04-08 16:39:06 +12:00
|
|
|
jobs:
|
2023-07-12 13:23:03 +12:00
|
|
|
nix-matrix:
|
2021-12-25 21:10:37 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
steps:
|
2023-10-02 02:00:47 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-03-08 07:23:08 +00:00
|
|
|
- uses: cachix/install-nix-action@v26
|
2021-12-25 21:10:37 -08:00
|
|
|
- id: set-matrix
|
2023-07-12 13:23:03 +12:00
|
|
|
name: Generate Nix Matrix
|
2021-12-30 07:23:53 -05:00
|
|
|
run: |
|
2023-10-28 07:37:10 -04:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
matrix="$(nix eval --json '.#githubActions.matrix')"
|
|
|
|
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
|
2021-12-25 21:10:37 -08:00
|
|
|
|
2023-07-12 13:23:03 +12:00
|
|
|
nix-build:
|
|
|
|
needs: nix-matrix
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-04-08 16:39:06 +12:00
|
|
|
strategy:
|
2023-10-25 04:50:27 -04:00
|
|
|
fail-fast: false
|
2023-12-12 14:22:07 +10:00
|
|
|
max-parallel: 10
|
2023-10-25 04:50:27 -04:00
|
|
|
matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }}
|
2020-04-08 16:39:06 +12:00
|
|
|
steps:
|
2023-10-02 02:00:47 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-03-08 07:23:08 +00:00
|
|
|
- uses: cachix/install-nix-action@v26
|
|
|
|
- uses: cachix/cachix-action@v14
|
2022-12-18 16:00:45 -05:00
|
|
|
with:
|
|
|
|
name: poetry2nix
|
|
|
|
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
|
2023-10-25 04:52:18 -04:00
|
|
|
- run: nix build -L ".#${{ matrix.attr }}" --keep-going
|
2023-07-10 07:16:06 -05:00
|
|
|
|
2023-10-28 06:12:01 -04:00
|
|
|
nix-build-shell:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-03-08 07:23:08 +00:00
|
|
|
- uses: cachix/install-nix-action@v26
|
|
|
|
- uses: cachix/cachix-action@v14
|
2023-10-28 06:12:01 -04:00
|
|
|
with:
|
|
|
|
name: poetry2nix
|
|
|
|
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
|
|
|
|
- name: compute system from nixpkgs
|
|
|
|
run: |
|
|
|
|
echo "NIXPKGS_SYSTEM=$(nix eval --raw 'nixpkgs#system')" >> "$GITHUB_ENV"
|
|
|
|
- run: nix build -L ".#devShells.${NIXPKGS_SYSTEM}.default" --keep-going
|
|
|
|
|
2023-11-05 00:33:43 -07:00
|
|
|
nix-flake-show:
|
|
|
|
# ensure flake-exposed endpoints (apps, packages, devShells) are of correct types
|
|
|
|
# (something like apps.${SYSTEM}.<app> can be hard to get right)
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-03-08 07:23:08 +00:00
|
|
|
- uses: cachix/install-nix-action@v26
|
|
|
|
- uses: cachix/cachix-action@v14
|
2023-11-05 00:33:43 -07:00
|
|
|
with:
|
|
|
|
name: poetry2nix
|
|
|
|
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
|
2023-11-05 12:53:22 -08:00
|
|
|
- run: nix flake show --all-systems
|
2023-11-05 00:33:43 -07:00
|
|
|
|
2023-10-26 06:27:56 -04:00
|
|
|
test-template:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-03-08 07:23:08 +00:00
|
|
|
- uses: cachix/install-nix-action@v26
|
|
|
|
- uses: cachix/cachix-action@v14
|
2023-10-26 06:27:56 -04:00
|
|
|
with:
|
|
|
|
name: poetry2nix
|
|
|
|
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
|
|
|
|
|
|
|
|
- name: create flake template test directory
|
|
|
|
run: echo "TESTDIR=$(mktemp -d)" >> "$GITHUB_ENV"
|
|
|
|
|
|
|
|
- name: initialize flake from poetry2nix template
|
|
|
|
working-directory: ${{ env.TESTDIR }}
|
2023-10-26 06:32:20 -04:00
|
|
|
run: nix flake init --template "$GITHUB_WORKSPACE"
|
2023-10-26 06:27:56 -04:00
|
|
|
|
2023-10-27 01:28:53 +03:00
|
|
|
- name: force flake to our poetry2nix version
|
|
|
|
working-directory: ${{ env.TESTDIR }}
|
|
|
|
run: nix flake lock --override-input poetry2nix "$GITHUB_WORKSPACE"
|
|
|
|
|
2023-10-26 06:27:56 -04:00
|
|
|
- name: generate poetry.lock
|
|
|
|
working-directory: ${{ env.TESTDIR }}
|
|
|
|
run: nix develop -c poetry lock --no-update
|
|
|
|
|
2023-10-26 06:38:38 -04:00
|
|
|
- name: create a minimal python package
|
|
|
|
working-directory: ${{ env.TESTDIR }}
|
|
|
|
run: |
|
2023-10-26 06:41:32 -04:00
|
|
|
touch README.md
|
2023-10-26 06:38:38 -04:00
|
|
|
mkdir poetry2nix_template_test
|
|
|
|
touch poetry2nix_template_test/__init__.py
|
|
|
|
|
2023-10-26 06:27:56 -04:00
|
|
|
- name: build the flake
|
|
|
|
working-directory: ${{ env.TESTDIR }}
|
|
|
|
run: nix build --keep-going -L --show-trace
|
|
|
|
|
2023-07-10 07:16:06 -05:00
|
|
|
collect:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
2023-07-12 13:23:03 +12:00
|
|
|
- nix-build
|
2023-10-28 07:10:49 -04:00
|
|
|
- nix-build-shell
|
2023-10-26 06:27:56 -04:00
|
|
|
- test-template
|
2023-11-05 12:53:22 -08:00
|
|
|
- nix-flake-show
|
2023-07-10 07:16:06 -05:00
|
|
|
steps:
|
2023-10-25 04:48:08 -04:00
|
|
|
- run: exit 0
|
2023-11-09 18:02:57 +13:00
|
|
|
|
|
|
|
release:
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
needs: collect
|
|
|
|
name: "Release"
|
|
|
|
runs-on: "ubuntu-latest"
|
2024-05-02 09:56:25 -04:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.repository }}-${{ github.workflow }}
|
|
|
|
cancel-in-progress: false
|
2023-11-09 18:02:57 +13:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: "Generate tag"
|
|
|
|
id: tag
|
|
|
|
run: echo tag=$(./tools/auto_version.py) >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
|
|
|
with:
|
|
|
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
automatic_release_tag: "${{ steps.tag.outputs.tag }}"
|
|
|
|
prerelease: false
|