forked from input-output-hk/haskell.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e57d373
commit 9d832fc
Showing
1 changed file
with
51 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,80 @@ | ||
name: Wait for Hydra Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "nix-tools-*" | ||
pull_request: | ||
check_suite: | ||
types: | ||
- completed | ||
|
||
env: | ||
FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }} | ||
FLAKE_REF: github:${{ github.repository }}/${{ github.sha }} | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
jobs: | ||
wait-for-hydra: | ||
upload-artifacts: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix with good defaults | ||
uses: input-output-hk/install-nix-action@v20 | ||
with: | ||
extra_nix_config: | | ||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= | ||
substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com | ||
# Any derivation should already have been built on Hydra, do not build anything here | ||
builders = | ||
max-jobs = 0 | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
|
||
- name: Display flake metadata | ||
id: flake-metadata | ||
run: | | ||
echo $PWD | ||
ls -lah . | ||
nix flake metadata ${{ env.FLAKE_REF }} | ||
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT" | ||
- name: Wait for nix-tools meta job | ||
uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs | ||
with: | ||
status: 'ci/hydra-build:nix-tools' | ||
run: nix flake metadata ${{ env.FLAKE_REF }} | ||
|
||
- name: "Pull nix-tools" | ||
run: | | ||
ls -lah . | ||
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | ||
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | ||
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . | ||
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd --no-link --print-out-paths)/*.zip . | ||
- name: Configure Git | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
git config --global user.name 'Auto Update Bot' | ||
git config --global user.email '[email protected]' | ||
- name: "Compute nix-tools-static.nix" | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
git fetch --all | ||
git switch --force static-nix-tools | ||
( | ||
echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {" | ||
for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do | ||
echo " ${arch} = pkgs.fetchurl { " | ||
echo " name = \"${arch}-nix-tools-static\";" | ||
echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";" | ||
echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";" | ||
echo " };" | ||
done | ||
echo "}" | ||
) > nix-tools-static.nix | ||
cat nix-tools-static.nix | ||
- name: Push to nix branch | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
git add nix-tools-static.nix | ||
git commit -m "update nix-tools-static.nix" | ||
git push origin static-nix-tools | ||
mapfile -t attrs <<EOF | ||
hydraJobs.aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd | ||
hydraJobs.x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd | ||
hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd | ||
hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd | ||
EOF | ||
for attr in $attrs; do | ||
OUT=$(nix build --no-link --print-out-paths "$FLAKE_REF#$attr") | ||
cp -v "$OUT/*.zip" . | ||
done | ||
- name: Release | ||
uses: input-output-hk/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
*-nix-tools-static.zip | ||
# - name: Configure Git | ||
# if: startsWith(github.ref, 'refs/tags/') | ||
# run: | | ||
# git config --global user.name 'Auto Update Bot' | ||
# git config --global user.email '[email protected]' | ||
|
||
# - name: "Compute nix-tools-static.nix" | ||
# if: startsWith(github.ref, 'refs/tags/') | ||
# run: | | ||
# git fetch --all | ||
# git switch --force static-nix-tools | ||
# ( | ||
# echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {" | ||
# for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do | ||
# echo " ${arch} = pkgs.fetchurl { " | ||
# echo " name = \"${arch}-nix-tools-static\";" | ||
# echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";" | ||
# echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";" | ||
# echo " };" | ||
# done | ||
# echo "}" | ||
# ) > nix-tools-static.nix | ||
# cat nix-tools-static.nix | ||
# | ||
# - name: Push to nix branch | ||
# if: startsWith(github.ref, 'refs/tags/') | ||
# run: | | ||
# git add nix-tools-static.nix | ||
# git commit -m "update nix-tools-static.nix" | ||
# git push origin static-nix-tools | ||
|