Skip to content

Commit

Permalink
Solve a "full disk" GA issue by rather rely on a matrix of jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka committed Mar 16, 2023
1 parent 57bcedf commit e9a697e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -16,7 +16,13 @@ on:
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ubuntu-latest
strategy:
# fail-fast: false # TODO: @angerman do we want that?
matrix:
devshell: ['ghc8107', 'ghc902', 'ghc925', 'ghc8107-minimal', 'ghc902-minimal', 'ghc925-minimal', 'ghc8107-static-minimal', 'ghc902-static-minimal', 'ghc925-static-minimal']
os: [ubuntu-latest, macOS-latest]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
steps:
- name: Install Nix with good defaults
uses: cachix/install-nix-action@v17
Expand All @@ -35,4 +41,6 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET }}
NIX_STORE_SECRET_KEY: ${{ secrets.SECRET_KEY }}
FLAKE_DEV_SHELL: ${{ matrix.devshell }}
GA_HOST_OS: ${{ matrix.os }}
run: ./extra/s3-uploads.sh
46 changes: 18 additions & 28 deletions extra/s3-uploads.sh
Expand Up @@ -2,20 +2,12 @@
#! nix-shell -i bash -p awscli zstd
set -euo pipefail

DEV_SHELLS=(
"ghc8107"
"ghc902"
"ghc925"
"ghc8107-minimal"
"ghc902-minimal"
"ghc925-minimal"
"ghc8107-static-minimal"
"ghc902-static-minimal"
"ghc925-static-minimal"
)

# TODO: darwin builds need to run non-sandboxed ...
SYSTEMS=("x86_64-linux") # ("aarch64-darwin" "aarch64-linux" "x86_64-darwin")
if [ "$GA_HOST_OS" == "ubuntu-latest" ]; then
SYSTEMS=("x86_64-linux") # TODO: aarch64-linux
fi
if [ "$GA_HOST_OS" == "macOS-latest" ]; then
SYSTEMS=("x86_64-darwin") # TODO: aarch64-darwin
fi

# `awscli` doesn't seems to provide a stateless mode :')
aws configure set aws_access_key_id "${AWS_ACCESS_KEY_ID}"
Expand All @@ -25,18 +17,16 @@ aws configure set aws_secret_access_key "${AWS_SECRET_ACCESS_KEY}"
echo "${NIX_STORE_SECRET_KEY}" > ./secret-key

for system in "${SYSTEMS[@]}"; do
for devShell in "${DEV_SHELLS[@]}"; do
DEV_SHELL="${system}.${devShell}"
FLAKE=".#devShells.${DEV_SHELL} --no-write-lock-file --refresh --system ${system} --accept-flake-config"
# shellcheck disable=SC2086
nix build ${FLAKE}
nix store sign --key-file ./secret-key --recursive ./result
# shellcheck disable=SC2046
nix-store --export $(nix-store -qR ./result) | zstd -z8T8 > "${DEV_SHELL}.zstd"
# shellcheck disable=SC2086
nix print-dev-env ${FLAKE} > "${DEV_SHELL}.sh"
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${DEV_SHELL}.zstd" s3://devx/
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${DEV_SHELL}.sh" s3://devx/
rm result
done
DEV_SHELL="${system}.${FLAKE_DEV_SHELL}"
FLAKE=".#devShells.${DEV_SHELL} --no-write-lock-file --refresh --system ${system} --accept-flake-config"
# shellcheck disable=SC2086
nix build ${FLAKE}
nix store sign --key-file ./secret-key --recursive ./result
# shellcheck disable=SC2046
nix-store --export $(nix-store -qR ./result) | zstd -z8T8 > "${DEV_SHELL}.zstd"
# shellcheck disable=SC2086
nix print-dev-env ${FLAKE} > "${DEV_SHELL}.sh"
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${DEV_SHELL}.zstd" s3://devx/
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${DEV_SHELL}.sh" s3://devx/
rm result
done

0 comments on commit e9a697e

Please sign in to comment.