Skip to content

Commit bede246

Browse files
authored
Update main.yml (#204)
* Update main.yml * Update main.yml * Update build-and-test.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Create container-upload.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update container-upload.yml * Lets try this appraoch * Add checkout phase * Meh * . * Add other platforms; fix label * Cleanup * More cleanup * Drop container-upload * Bring tests back * retry is the solution 🤦
1 parent 204e23d commit bede246

File tree

8 files changed

+62
-181
lines changed

8 files changed

+62
-181
lines changed

Diff for: .github/workflows/aarch64-darwin.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: DevX closures for aarch64-darwin
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
name: Prebuild and Upload
9+
uses: ./.github/workflows/main.yml
10+
with:
11+
platform: aarch64-darwin

Diff for: .github/workflows/aarch64-linux.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: DevX closures for aarch64-linux
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
name: Prebuild and Upload
9+
uses: ./.github/workflows/main.yml
10+
with:
11+
platform: aarch64-linux

Diff for: .github/workflows/hello.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Test that we can build the hello world example form hackage
2+
23
on:
34
push:
45
workflow_dispatch:

Diff for: .github/workflows/main.yml

+15-33
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Prebuild DevX closures
2-
on:
3-
push:
4-
branches:
5-
- main
62

7-
workflow_dispatch:
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
89

910
env:
1011
REGISTRY: ghcr.io
@@ -36,49 +37,28 @@ jobs:
3637
# Group the output by platform.
3738
RUNS=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs" --paginate)
3839
echo "checks..."
39-
FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | { "config": .name, "build_path": .output.text }' <<< "$RUNS")
40-
echo "filtered..."
41-
MATRIX=$(jq --slurp -c -r '. as $jobs | map(.config | split(".") | first) | unique | map(. as $group | {"platform": $group, "jobs": $jobs | map(select(.config |startswith($group)))})' <<< "$FILTERED")
42-
echo "groups..."
43-
if jq -e . <<< "$MATRIX" > /dev/null 2>&1; then # JSON validation
44-
echo "Valid JSON"
45-
else
46-
echo "Invalid JSON: $MATRIX"
47-
exit 1 # or handle the error appropriately
48-
fi
40+
FILTERED=$(jq -c -r '.check_runs[] | select(.name | endswith("-env")) | select(.name | startswith("${{ inputs.platform }}")) | { "config": .name, "build_path": .output.text, "short_name": .name | sub("${{ inputs.platform }}\\.";"") }' <<< "$RUNS")
41+
jq . <<< "$FILTERED"
42+
MATRIX=$(jq --slurp -c -r '.' <<< "$FILTERED")
43+
jq . <<< "$MATRIX"
4944
echo "creating result matrix."
5045
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
5146
5247
# We need this process step in here, because we have in excess of 256 jobs.
5348
process:
5449
needs: discover
55-
runs-on: ubuntu-latest # You still need runs-on to define a job, but it can be minimal
56-
strategy:
57-
fail-fast: false
58-
matrix:
59-
group: ${{ fromJson(needs.discover.outputs.matrix) }}
60-
name: Process Jobs for ${{ matrix.group.platform }}
61-
outputs:
62-
jobs: ${{ toJson(matrix.group.jobs) }} # Direct output definition
63-
steps:
64-
- name: No-op step (required to have at least one step)
65-
run: echo "No-op" # Minimal step to satisfy step requirement
66-
67-
ghcr-upload:
68-
needs: process
69-
name: Container Upload
50+
runs-on: ubuntu-latest
7051
strategy:
7152
fail-fast: false
7253
matrix:
73-
job: ${{ fromJson(needs.process.outputs.matrix) }}
74-
runs-on: ubuntu-latest
54+
job: ${{ fromJson(needs.discover.outputs.matrix) }}
55+
name: GHCR Upload for ${{ matrix.job.short_name }}
7556
permissions:
7657
contents: read
7758
packages: write
7859
steps:
7960
- name: Free Disk Space (Ubuntu)
8061
uses: jlumbroso/free-disk-space@main
81-
8262
- name: Install Nix with good defaults
8363
uses: cachix/install-nix-action@v20
8464
with:
@@ -101,6 +81,8 @@ jobs:
10181
NIX_STORE_SECRET_KEY: ${{ secrets.SECRET_KEY }}
10282
run: ./extra/ghcr-upload.sh
10383

84+
85+
10486
# codespace-upload:
10587
# env:
10688
# IMAGE_NAME: input-output-hk/devx-devcontainer

Diff for: .github/workflows/wait-and-upload.yml

-147
This file was deleted.

Diff for: .github/workflows/x86_64-darwin.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: DevX closures for x86_64-darwin
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
name: Prebuild and Upload
9+
uses: ./.github/workflows/main.yml
10+
with:
11+
platform: x86_64-darwin

Diff for: .github/workflows/x86_64-linux.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: DevX closures for x86_64-linux
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
name: Prebuild and Upload
9+
uses: ./.github/workflows/main.yml
10+
with:
11+
platform: x86_64-linux

Diff for: extra/ghcr-upload.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -euox pipefail
55
: "${DEV_SHELL:?'DEV_SHELL is not set'}"
66
: "${SHELL_NIX_PATH:?'SHELL_NIX_PATH is not set'}"
77

8-
nix-store -r "$SHELL_NIX_PATH"
8+
# retry three times in case of intermittent network errors.
9+
nix-store -r "$SHELL_NIX_PATH" || nix-store -r "$SHELL_NIX_PATH" || nix-store -r "$SHELL_NIX_PATH"
910
#nix build ".#hydraJobs.${DEV_SHELL}" --show-trace --accept-flake-config
1011
nix-store --export $(nix-store -qR "$SHELL_NIX_PATH") | tee store-paths.txt | zstd -z8T8 >${DEV_SHELL}
1112
if [[ ! $(tail -n 1 store-paths.txt) =~ "devx" ]]; then exit 1; fi

0 commit comments

Comments
 (0)