Skip to content

Commit e6a39bd

Browse files
committed
return
1 parent 6a98a4b commit e6a39bd

File tree

1 file changed

+133
-100
lines changed

1 file changed

+133
-100
lines changed

.github/workflows/ci-waspc-build.yaml

Lines changed: 133 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -21,90 +21,125 @@ env:
2121
WASP_TELEMETRY_DISABLE: 1
2222

2323
jobs:
24-
# == Why such a big, heterogeneous list? ==
25-
# This is a bit of mish-mash of different platforms and architectures,
26-
# so we need to build some of these directly in the runners, and some in
27-
# containers. Each environment is a different OS and needs different
28-
# dependencies.
29-
#
30-
# When possible, we build inside containers so we are not affected when
31-
# GitHub updates the runners or deprecates old ones. When we build inside
32-
# containers, the runner is only used to host the container, and all the
33-
# steps are run inside the container and not the host (like a Dockerfile).
34-
35-
build-linux-x86_64:
36-
name: Build Wasp (linux-x86_64)
37-
uses: ./.github/workflows/ci-waspc-build-template.yaml
38-
with:
39-
build-name: linux-x86_64
40-
runner: ubuntu-latest
41-
# We use an old Ubuntu version so we can link to a low `glibc` version.
42-
# `glibc` is backwards-compatible but not forwards-compatible, so it
43-
# is a good idea to use the oldest version we reasonably can. Otherwise,
44-
# the wasp binary would possibly not work on the system using an older
45-
# glibc than what it was built with (e.g. an older Ubuntu version).
46-
container: ubuntu:20.04
47-
node-version: ${{ inputs.node-version }}
48-
static: false
49-
install-deps: |
50-
export DEBIAN_FRONTEND=noninteractive
51-
apt-get update -y
52-
# GHCup dependencies (https://www.haskell.org/ghcup/install/#version-2004-2010)
53-
apt-get install -y build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
54-
# Cabal dependencies
55-
apt-get install -y zlib1g-dev
56-
57-
build-linux-x86_64-static:
58-
name: Build Wasp (linux-x86_64-static)
59-
uses: ./.github/workflows/ci-waspc-build-template.yaml
60-
with:
61-
build-name: linux-x86_64-static
62-
runner: ubuntu-latest
63-
# actions/setup-node does not work in alpine.
64-
# https://github.com/actions/setup-node/issues/1293 To work around
65-
# this, we use the alpine variant of the official node image, which
66-
# already has a working Node.js version installed.
67-
# We also pin the `alpine` version to a specific one we have tested,
68-
# since newer releases might have different versions of the
69-
# libraries we depend on.
70-
container: node:${{ inputs.node-version }}-alpine3.21
71-
static: true
72-
install-deps: |
73-
apk update
74-
# GHCup dependencies (https://www.haskell.org/ghcup/install/#linux-alpine)
75-
apk add binutils-gold curl gcc g++ gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev perl pkgconfig tar xz
76-
# `./run` script dependencies
77-
apk add bash
78-
# Cabal dependencies
79-
apk add zlib-dev zlib-static
80-
81-
build-macos-x86_64:
82-
name: Build Wasp (macos-x86_64)
83-
uses: ./.github/workflows/ci-waspc-build-template.yaml
84-
with:
85-
build-name: macos-x86_64
86-
runner: macos-15-intel
87-
node-version: ${{ inputs.node-version }}
88-
# macOS's syscalls are private and change between versions, so we
89-
# can't statically link the binary.
90-
static: false
91-
92-
build-macos-aarch64:
93-
name: Build Wasp (macos-aarch64)
94-
uses: ./.github/workflows/ci-waspc-build-template.yaml
95-
with:
96-
build-name: macos-aarch64
97-
runner: macos-15 # By default an Apple Silicon-based runner.
98-
node-version: ${{ inputs.node-version }}
99-
static: false # Check the comment above for why we can't statically link on macOS
100-
101-
build-macos-universal:
24+
build:
25+
outputs:
26+
output_linux-x86_64: ${{ steps.set-outputs.outputs.output_linux-x86_64 }}
27+
output_linux-x86_64-static: ${{ steps.set-outputs.outputs.output_linux-x86_64-static }}
28+
output_macos-x86_64: ${{ steps.set-outputs.outputs.output_macos-x86_64 }}
29+
output_macos-aarch64: ${{ steps.set-outputs.outputs.output_macos-aarch64 }}
30+
31+
strategy:
32+
fail-fast: false
33+
34+
matrix:
35+
# == Why such a big, heterogeneous list? ==
36+
# This is a bit of mish-mash of different platforms and architectures,
37+
# so we need to build some of these directly in the runners, and some in
38+
# containers. Each environment is a different OS and needs different
39+
# dependencies.
40+
#
41+
# When possible, we build inside containers so we are not affected when
42+
# GitHub updates the runners or deprecates old ones. When we build inside
43+
# containers, the runner is only used to host the container, and all the
44+
# steps are run inside the container and not the host (like a Dockerfile).
45+
env:
46+
- name: linux-x86_64
47+
runner: ubuntu-latest
48+
# We use an old Ubuntu version so we can link to a low `glibc` version.
49+
# `glibc` is backwards-compatible but not forwards-compatible, so it
50+
# is a good idea to use the oldest version we reasonably can. Otherwise,
51+
# the wasp binary would possibly not work on the system using an older
52+
# glibc than what it was built with (e.g. an older Ubuntu version).
53+
container: ubuntu:20.04
54+
static: false
55+
install-deps: |
56+
export DEBIAN_FRONTEND=noninteractive
57+
apt-get update -y
58+
# GHCup dependencies (https://www.haskell.org/ghcup/install/#version-2004-2010)
59+
apt-get install -y build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
60+
# Cabal dependencies
61+
apt-get install -y zlib1g-dev
62+
63+
- name: linux-x86_64-static
64+
runner: ubuntu-latest
65+
# actions/setup-node does not work in alpine.
66+
# https://github.com/actions/setup-node/issues/1293 To work around
67+
# this, we use the alpine variant of the official node image, which
68+
# already has a working Node.js version installed.
69+
# We also pin the `alpine` version to a specific one we have tested,
70+
# since newer releases might have different versions of the
71+
# libraries we depend on.
72+
container: node:${{ inputs.node-version }}-alpine3.21
73+
skip-node-install: true
74+
static: true
75+
install-deps: |
76+
apk update
77+
# GHCup dependencies (https://www.haskell.org/ghcup/install/#linux-alpine)
78+
apk add binutils-gold curl gcc g++ gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev perl pkgconfig tar xz
79+
# `./run` script dependencies
80+
apk add bash
81+
# Cabal dependencies
82+
apk add zlib-dev zlib-static
83+
84+
- name: macos-x86_64
85+
runner: macos-15-intel
86+
# macOS's syscalls are private and change between versions, so we
87+
# can't statically link the binary.
88+
static: false
89+
90+
- name: macos-aarch64
91+
runner: macos-15 # By default an Apple Silicon-based runner.
92+
static: false # Check the comment above for why we can't statically link on macOS
93+
94+
runs-on: ${{ matrix.env.runner }}
95+
container: ${{ matrix.env.container }}
96+
name: Build Wasp (${{ matrix.env.name }})
97+
98+
steps:
99+
- uses: actions/checkout@v5
100+
101+
- uses: ./.github/actions/compute-artifact-names
102+
id: compute-artifact-names
103+
with:
104+
build-name: ${{ matrix.env.name }}
105+
106+
- name: Install dependencies
107+
if: ${{ matrix.env.install-deps }}
108+
run: ${{ matrix.env.install-deps }}
109+
110+
- uses: ./.github/actions/setup-haskell
111+
with:
112+
extra-cache-key-segment: ${{ matrix.env.static && 'static' || 'default' }}
113+
114+
- uses: actions/setup-node@v5
115+
if: ${{ !matrix.env.skip-node-install }}
116+
with:
117+
node-version: ${{ inputs.node-version }}
118+
119+
- name: Build and package
120+
working-directory: waspc
121+
env:
122+
LC_ALL: C.UTF-8 # In some Docker containers the LOCALE is not UTF-8 by default
123+
run: |
124+
./run build:all${{ matrix.env.static && ':static' || '' }}
125+
mkdir -p artifacts
126+
./tools/make_binary_package.sh "artifacts/${{ steps.compute-artifact-names.outputs.tarball-name }}"
127+
128+
- uses: actions/upload-artifact@v4
129+
with:
130+
path: ./waspc/artifacts/${{ steps.compute-artifact-names.outputs.tarball-name }}
131+
name: ${{ steps.compute-artifact-names.outputs.artifact-name }}
132+
if-no-files-found: error
133+
134+
- id: set-outputs
135+
name: Set job outputs
136+
run: |
137+
echo "output_${{ matrix.env.name }}=${{ steps.compute-artifact-names.outputs.artifact-name }}" >> $GITHUB_OUTPUT
138+
139+
build-universal:
102140
name: Build Wasp (universal)
103-
needs:
104-
- build-macos-x86_64
105-
- build-macos-aarch64
141+
needs: build
106142
runs-on: macos-15
107-
108143
steps:
109144
- uses: actions/checkout@v6
110145

@@ -113,36 +148,38 @@ jobs:
113148
with:
114149
build-name: macos-universal
115150

116-
- name: Download macOS Intel artifact
117-
uses: actions/download-artifact@v6
151+
- name: Download macOS Intel binaries
152+
uses: actions/download-artifact@v5
118153
with:
119-
name: ${{ needs.build-macos-x86_64.outputs.artifact-name }}
154+
name: "${{ needs.build.outputs.output_macos-x86_64.artifact-name }}"
120155

121-
- name: Download macOS ARM artifact
122-
uses: actions/download-artifact@v6
156+
- name: Download macOS ARM binaries
157+
uses: actions/download-artifact@v5
123158
with:
124-
name: ${{ needs.build-macos-aarch64.outputs.artifact-name }}
159+
name: "${{ needs.build.outputs.output_macos-aarch64.artifact-name }}"
125160

126161
- name: Unpack, create universal binary and pack
127162
run: |
128163
set -ex # Fail on error and print each command
129164
130-
input_arch=(
131-
macos-x86_64
132-
macos-aarch64
165+
input_files=(
166+
"${{ needs.build.outputs.output_macos-x86_64.tarball-name }}"
167+
"${{ needs.build.outputs.output_macos-aarch64.tarball-name }}"
133168
)
134169
135170
# Extract each architecture
136-
for arch in "${input_arch[@]}"; do
137-
mkdir "arch-$arch"
138-
tar -xzf "wasp-cli-${arch}/wasp-${arch}.tar.gz" -C "arch-$arch"
171+
i=0;
172+
for file in "${input_files[@]}"; do
173+
mkdir "arch-$i"
174+
tar -xzf $file -C "arch-$i"
175+
i=$((i + 1))
139176
done
140177
141178
mkdir universal
142179
# Create the universal binary
143180
lipo -create arch-*/wasp-bin -output universal/wasp-bin
144-
# Copy the data folder too
145-
cp -R "arch-${input_arch[0]}/data" universal/
181+
# Copy the data folder too (we take the first one, should be identical in both)
182+
cp -R "arch-0/data" universal/
146183
147184
# Pack back up
148185
tar -czf ${{ steps.compute-artifact-names.outputs.tarball-name }} -C universal .
@@ -151,7 +188,3 @@ jobs:
151188
with:
152189
name: ${{ steps.compute-artifact-names.outputs.artifact-name }}
153190
path: ./${{ steps.compute-artifact-names.outputs.tarball-name }}
154-
155-
outputs:
156-
tarball-name: ${{ steps.compute-artifact-names.outputs.tarball-name }}
157-
artifact-name: ${{ steps.compute-artifact-names.outputs.artifact-name }}

0 commit comments

Comments
 (0)