Repository navigation
107 lines (104 loc) · 4.12 KB
/
Copy pathproduction.yml
File metadata and controls
107 lines (104 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Production binaries
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
if: github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
platform: x86_64-linux
- os: macos-14
platform: arm64-macos
runs-on: ${{ matrix.os }}
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: true
- name: Configure and build
shell: bash
run: |
set -euo pipefail
version="132-zed-$GITHUB_SHA"
echo "VERSION=$version" >> "$GITHUB_ENV"
flags=()
if [[ "$RUNNER_OS" == Linux ]]; then
flags+=("-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -static-libgcc")
test "$(uname -m)" = x86_64
else
test "$(uname -m)" = arm64
flags+=("-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0" "-DCMAKE_OSX_ARCHITECTURES=arm64")
fi
cmake -S . -B out -DCMAKE_BUILD_TYPE=Release \
-DBINARYEN_VERSION="$version" -DBUILD_SHARED_LIBS=OFF \
-DBUILD_LLVM_DWARF=ON -DBUILD_TESTS=OFF \
-DENABLE_WERROR=OFF "${flags[@]}"
cmake --build out --parallel 3 --target wasm-opt wasm-as wasm-dis
- name: Test and package
shell: bash
run: |
set -euo pipefail
root="binaryen-version_$VERSION"
archive="$root-${{ matrix.platform }}.tar.gz"
mkdir -p "$root/bin" dist
cp out/bin/{wasm-opt,wasm-as,wasm-dis} "$root/bin/"
cp LICENSE "$root/"
for tool in "$root"/bin/*; do
test "$("$tool" --version | awk '{print $3}')" = "$VERSION"
if [[ "$RUNNER_OS" == Linux ]]; then
ldd "$tool" | tee dependencies.txt
! grep -E 'libbinaryen|libstdc\+\+|libgcc_s|not found' dependencies.txt
else
otool -L "$tool" | tee dependencies.txt
python3 -c 'from pathlib import Path; lines = Path("dependencies.txt").read_text().splitlines()[1:]; assert all(line.strip().startswith(("/usr/lib/", "/System/Library/")) for line in lines), lines'
fi
done
BINARYEN_ROOT="$PWD/$root" python3 -m unittest \
test.unit.test_dwarf test.unit.test_dwarf_relocation test.unit.test_dwarf_locations
printf '%s\n' "$GITHUB_SHA" > "$root/SOURCE_COMMIT"
tar -czf "dist/$archive" "$root"
(cd dist && shasum -a 256 "$archive" > "$archive.sha256")
- uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
with:
subject-path: dist/*.tar.gz
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: binaryen-${{ matrix.platform }}
path: dist/*
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
pattern: binaryen-*
merge-multiple: true
path: dist
- name: Publish commit-pinned release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
cd dist
cat *.sha256 > SHA256SUMS
sha256sum --check SHA256SUMS
tag="version_132-zed-$GITHUB_SHA"
# Never replace previously published assets on a retry.
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
--target "$GITHUB_SHA" --title "Binaryen 132 Zed ($GITHUB_SHA)" \
--notes "Source: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA. LLVM DWARF enabled; Binaryen statically linked. Linux x86_64 requires glibc 2.35 or newer; macOS ARM64 requires macOS 14 or newer. Verify checksums with SHA256SUMS and provenance with gh attestation verify --repo $GITHUB_REPOSITORY <archive>." \
./*.tar.gz ./*.sha256 SHA256SUMS