mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
ci: use jq to construct builds matrix
This commit is contained in:
parent
ed58e6c7a6
commit
5303a36635
2 changed files with 5 additions and 28 deletions
27
.github/generate-matrix.py
vendored
27
.github/generate-matrix.py
vendored
|
@ -1,27 +0,0 @@
|
|||
#!/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()
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -26,7 +26,11 @@ jobs:
|
|||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: experimental-features = nix-command
|
||||
- id: set-matrix
|
||||
run: ./.github/generate-matrix.py
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
matrix="$(nix-instantiate --eval --json --expr 'builtins.attrNames (import ./tests {})' | jq '{attr: .}')"
|
||||
echo "::set-output name=matrix::$matrix"
|
||||
|
||||
builds:
|
||||
needs: matrix_generate
|
||||
|
|
Loading…
Add table
Reference in a new issue