Skip to content

Commit

Permalink
Test list-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Nov 2, 2023
1 parent 06dfb36 commit c2091d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,21 @@ jobs:
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: echo "package=$(./foo)" >> "$GITHUB_OUTPUT"
id: foo
- run: echo $FOO
env:
FOO: ${{ steps.foo.outputs.package }}
- run: echo "package=$(./list_packages)" >> "$GITHUB_OUTPUT"
id: list-packages
outputs:
package: ${{ steps.foo.ouputs.package }}
package: ${{ steps.list-packages.ouputs.package }}

build:
# strategy:
# matrix:
# runner:
# - os: macos-latest
# system: x86_64-darwin
# - os: ubuntu-latest
# system: x86_64-linux
# package: ${{ needs.pre-build.outputs.package }}
strategy:
matrix:
# runner:
# - os: macos-latest
# system: x86_64-darwin
# - os: ubuntu-latest
# system: x86_64-linux
package: ${{ needs.pre-build.outputs.package }}
# runs-on: ${{ matrix.runner.os }}
if: false
runs-on: ubuntu-latest
needs: [pre-build]
steps:
Expand Down
10 changes: 7 additions & 3 deletions foo → list_packages
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import json
import semver

def foo(version):
def to_package(version):
splitted_version = version.split(".")
package_suffix = "_".join(splitted_version)
return { "version": version, "package": f"terraform-{package_suffix}", "allow_unfree": 1 if semver.compare(version, "1.6.0") >= 0 else 0 }
return {
"package": f"terraform-{package_suffix}",
"version": version,
"allow_unfree": 1 if semver.compare(version, "1.6.0") >= 0 else 0
}

with open("versions.json") as f:
versions = json.load(f)
result = list(map(foo, versions))
result = list(map(to_package, versions))
print(json.dumps(result))

0 comments on commit c2091d2

Please sign in to comment.