mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-05 09:11:39 -05:00
Switch testing strategy on Github Actions to one based on a dynamic matrix
Currently the output is unreadable (I have no idea without digging _what_ test failed).
This commit is contained in:
parent
0268361a12
commit
3f40ecc951
2 changed files with 55 additions and 19 deletions
27
.github/generate-matrix.py
vendored
Executable file
27
.github/generate-matrix.py
vendored
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
expr = 'builtins.toJSON (builtins.attrNames (import ./tests {}))'
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
attrs = json.loads(json.loads(subprocess.check_output([
|
||||||
|
"nix-instantiate",
|
||||||
|
"--eval",
|
||||||
|
"--expr",
|
||||||
|
expr
|
||||||
|
])))
|
||||||
|
|
||||||
|
matrix = [
|
||||||
|
{
|
||||||
|
"attr": attr
|
||||||
|
}
|
||||||
|
for attr in attrs
|
||||||
|
]
|
||||||
|
|
||||||
|
sys.stdout.write("::set-output name=matrix::")
|
||||||
|
json.dump({"include": matrix}, sys.stdout)
|
||||||
|
sys.stdout.flush()
|
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
|
@ -2,9 +2,6 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nixpkgs-fmt:
|
nixpkgs-fmt:
|
||||||
|
@ -18,20 +15,32 @@ jobs:
|
||||||
- name: Check format
|
- name: Check format
|
||||||
run: ./check-fmt
|
run: ./check-fmt
|
||||||
|
|
||||||
build:
|
matrix_generate:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
outputs:
|
||||||
matrix:
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
os: [ubuntu-latest]
|
|
||||||
# os: [ubuntu-latest, macos-latest]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: cachix/install-nix-action@v14
|
- uses: actions/checkout@v2.4.0
|
||||||
with:
|
- uses: cachix/install-nix-action@v14
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
with:
|
||||||
extra_nix_config: experimental-features = nix-command
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
- uses: actions/checkout@v2.4.0
|
extra_nix_config: experimental-features = nix-command
|
||||||
- uses: cachix/cachix-action@v10
|
- id: set-matrix
|
||||||
with:
|
run: ./.github/generate-matrix.py
|
||||||
name: poetry2nix
|
|
||||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
builds:
|
||||||
- run: nix-shell -p nix-build-uncached --run 'nix-build-uncached --keep-going --show-trace tests/default.nix'
|
needs: matrix_generate
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix: ${{fromJSON(needs.matrix_generate.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.4.0
|
||||||
|
- uses: cachix/install-nix-action@v14
|
||||||
|
with:
|
||||||
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
extra_nix_config: experimental-features = nix-command
|
||||||
|
- uses: cachix/cachix-action@v10
|
||||||
|
with:
|
||||||
|
name: poetry2nix
|
||||||
|
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||||
|
- run: nix-shell -p nix-build-uncached --run 'nix-build-uncached --keep-going --show-trace tests/default.nix -A ${{ matrix.attr }}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue