Skip to content

Commit dbafd9d

Browse files
committed
Build LTO and non-LTO versions, pin vcpkg version
1 parent 154c7b0 commit dbafd9d

File tree

1 file changed

+69
-12
lines changed

1 file changed

+69
-12
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ concurrency:
1717
env:
1818
LLVM_VER: 17
1919
PYTHON_VER: 3.11
20-
VCPKG_REGISTRY_VERSION: v1.1.0
20+
VCPKG_REGISTRY_VERSION: v1.2.0
21+
VCPKG_COMMIT: fecdd89f28ed883b26a48c2b30085f6384070bb8
2122

2223
jobs:
2324
build:
@@ -30,6 +31,14 @@ jobs:
3031
contents: write
3132
packages: write
3233

34+
strategy:
35+
matrix:
36+
include:
37+
- name: lto
38+
additional_flags: -flto
39+
- name: nolto
40+
additional_flags:
41+
3342
steps:
3443
- name: Checkout repository
3544
uses: actions/checkout@v4
@@ -53,6 +62,12 @@ jobs:
5362
chmod 600 ~/.ssh/known_hosts
5463
echo "$MX_REGISTRY_KEY" | ssh-add -
5564
git submodule update --init --recursive -- vcpkg-registry
65+
66+
cd vcpkg-registry
67+
git fetch
68+
head_hash="$(git rev-parse HEAD)"
69+
tag_hash="$(git rev-parse $VCPKG_REGISTRY_VERSION)"
70+
[[ "$head_hash" == "$tag_hash" ]] || { echo 'The $VCPKG_REGISTRY_VERSION specified in CI and the submodule commit don't match. You probably updated $VCPKG_REGISTRY_VERSION without updating the submodule version as well.' ; exit 1 }
5671
env:
5772
MX_REGISTRY_KEY: ${{ secrets.MX_REGISTRY_KEY }}
5873

@@ -68,26 +83,27 @@ jobs:
6883
run: |
6984
echo "RELEASE_DIR=${RUNNER_TEMP}/release" >> $GITHUB_ENV
7085
echo "VERSION=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
71-
echo "ARTIFACT_NAME=multiplier-$(git rev-parse --short=7 HEAD).tar.xz" >> $GITHUB_ENV
86+
echo "ARTIFACT_NAME=multiplier-$(git rev-parse --short=7 HEAD)-${{ matrix.name }}.tar.xz" >> $GITHUB_ENV
7287
echo "CC=$(which clang-$LLVM_VER)" >> $GITHUB_ENV
7388
echo "CXX=$(which clang++-$LLVM_VER)" >> $GITHUB_ENV
74-
echo "CFLAGS=-g0 --ld-path=$(which ld.lld-$LLVM_VER)" >> $GITHUB_ENV
75-
echo "CXXFLAGS=-g0 --ld-path=$(which ld.lld-$LLVM_VER)" >> $GITHUB_ENV
89+
echo "CFLAGS=-g0 --ld-path=$(which ld.lld-$LLVM_VER) ${{ matrix.additional_flags }}" >> $GITHUB_ENV
90+
echo "CXXFLAGS=-g0 --ld-path=$(which ld.lld-$LLVM_VER) ${{ matrix.additional_flags }}" >> $GITHUB_ENV
7691
echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg-binary-cache,readwrite" >> $GITHUB_ENV
7792
7893
- name: Setup vcpkg
7994
run: |
8095
mkdir -p $GITHUB_WORKSPACE/vcpkg-binary-cache
8196
git clone https://github.com/microsoft/vcpkg $HOME/vcpkg
82-
$HOME/vcpkg/bootstrap-vcpkg.sh
97+
git -C $HOME/vcpkg checkout $VCPKG_COMMIT
98+
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
8399
84100
- name: Preseed vcpkg cache
85101
run: |
86102
gh release download $VCPKG_REGISTRY_VERSION \
87-
--pattern vcpkg-binary-cache.tar.bz2 \
103+
--pattern vcpkg-binary-cache-${{ matrix.name }}.tar.bz2 \
88104
--repo trailofbits/multiplier-vcpkg-registry
89-
tar xjf vcpkg-binary-cache.tar.bz2
90-
rm vcpkg-binary-cache.tar.bz2
105+
tar xjf vcpkg-binary-cache-${{ matrix.name }}.tar.bz2
106+
rm vcpkg-binary-cache-${{ matrix.name }}.tar.bz2
91107
env:
92108
GITHUB_TOKEN: ${{ secrets.MX_REGISTRY_RELEASES_TOKEN }}
93109

@@ -96,9 +112,9 @@ jobs:
96112
uses: actions/cache@v4
97113
with:
98114
path: vcpkg-binary-cache
99-
key: ${{ runner.os }}-${{ hashFiles('vcpkg-registry/ports/**/*') }}
115+
key: ${{ runner.os }}-${{ matrix.name }}-${{ hashFiles('vcpkg-registry/ports/**/*') }}
100116
restore-keys: |
101-
${{ runner.os }}-${{ hashFiles('vcpkg-registry/ports/**/*') }}
117+
${{ runner.os }}-${{ matrix.name }}-${{ hashFiles('vcpkg-registry/ports/**/*') }}
102118
${{ runner.os }}-
103119
104120
- name: Build
@@ -120,8 +136,49 @@ jobs:
120136
working-directory: ${{ env.RELEASE_DIR }}
121137
run: tar --use-compress-program pixz -cf "${ARTIFACT_NAME}" *
122138

123-
- name: Create Release
139+
- name: Upload cache artifact
124140
if: github.ref == 'refs/heads/main'
125-
run: gh release create ${VERSION} --generate-notes ${{ env.RELEASE_DIR }}/${{ env.ARTIFACT_NAME }}
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: multiplier-${{ matrix.name }}
144+
path: ${{ env.RELEASE_DIR }}/${{ env.ARTIFACT_NAME }}
145+
146+
create-release:
147+
runs-on: ubuntu-latest
148+
needs: [build]
149+
if: github.ref == 'refs/heads/main'
150+
name: Create release
151+
152+
permissions:
153+
contents: write
154+
packages: write
155+
156+
steps:
157+
- name: Checkout
158+
uses: actions/checkout@v4
159+
with:
160+
submodules: "recursive"
161+
162+
- name: Download artifacts
163+
uses: actions/download-artifact@v4
164+
with:
165+
run-id: build
166+
167+
- name: Install gh and extract
168+
run: |
169+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
170+
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
171+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
172+
173+
sudo apt-get update
174+
sudo apt-get install gh
175+
echo "VERSION=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
176+
echo "ARTIFACT_PREFIX=multiplier-$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
177+
178+
- name: Create release
179+
run: |
180+
gh release create "${{ env.VERSION }}" --generate-notes \
181+
multiplier-lto/${{ env.ARTIFACT_PREFIX }}-lto.tar.xz \
182+
multiplier-nolto/${{ env.ARTIFACT_PREFIX }}-nolto.tar.xz \
126183
env:
127184
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)