-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI Support #1
Changes from 29 commits
5607b3c
432ae47
7bb40c1
ebc034a
b81731b
787da16
83a06e9
b924dd7
c4b327c
692e734
e46bdb2
a034d34
44622a4
a041388
b89ecac
7e7b23a
125037d
19b7282
0c064bd
d45da73
2800c8c
075bb4e
4ae9ef6
623984d
016c5fa
620e52d
9a662ba
4975539
6e81e4d
27611ed
b4a573f
6a859cd
0a0cfcd
f331c71
bfd494a
445ae4b
40d8f2f
603d947
3e8246f
7e86db6
e76ca45
b373727
bdfe783
bfd15df
cf70013
213a8cf
ddf9b24
993c1ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build Tools | ||
|
||
on: | ||
push: | ||
branches: | ||
- oz/ci # TODO: change this | ||
|
||
jobs: | ||
build-mac: | ||
runs-on: macos-latest | ||
env: | ||
TAG: ${{ github.ref_name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: brew install just ninja | ||
- name: Clone | ||
run: just clone | ||
- name: Prepare | ||
run: just prepare | ||
- name: Build rust, cargo and newlib | ||
run: just build-all | ||
- name: Package | ||
env: | ||
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }} | ||
APPLE_CRED: ${{ secrets.APPLE_CRED }} | ||
APPLE_P12_BASE64: ${{ secrets.APPLE_P12_BASE64 }} | ||
APPLE_P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }} | ||
APPLE_TEAMID: ${{ secrets.APPLE_TEAMID }} | ||
APPLE_TEMPKEYCHAIN_PASSWORD: ${{ secrets.APPLE_TEMPKEYCHAIN_PASSWORD }} | ||
run: just package | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: platform-tools-osx-aarch64.tar.bz2 | ||
path: out/platform-tools-osx-aarch64.tar.bz2 | ||
|
||
build-linux: | ||
runs-on: ubuntu-latest | ||
env: | ||
TAG: ${{ github.ref_name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install just | ||
uses: taiki-e/install-action@just | ||
- name: Install ninja | ||
run: sudo apt update; sudo apt install ninja-build | ||
- name: Clone | ||
run: just clone | ||
- name: Prepare | ||
run: just prepare | ||
- name: Build rust, cargo and newlib | ||
run: just build-all | ||
- name: Package | ||
run: just package | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: platform-tools-linux-x86_64.tar.bz2 | ||
path: out/platform-tools-linux-x86_64.tar.bz2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,26 @@ if [[ "${HOST_TRIPLE}" != "x86_64-pc-windows-msvc" ]] ; then | |
#cp -R rust/build/${HOST_TRIPLE}/llvm/lib/python* deploy/llvm/lib/ | ||
fi | ||
|
||
# Sign macOS binaries | ||
if [[ $HOST_TRIPLE == *apple-darwin* ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has to be outside of In the current state, I will not be able to build this locally since signing will fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. your right it will failed locally. how about adding a flag so the signing process will not run by default but only when ci is running ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you already use some local variables as part of singing process to communicate the key. You can just check whether they are set and not sign if they are not. |
||
LLVM_BIN="./deploy/llvm/bin" | ||
RUST_BIN="./deploy/rust/bin" | ||
RUST_LIB="./deploy/rust/lib" | ||
|
||
../scripts/sign.sh \ | ||
"$LLVM_BIN/llvm-objdump" \ | ||
"$LLVM_BIN/llvm-ar" \ | ||
"$LLVM_BIN/llvm-readobj" \ | ||
"$LLVM_BIN/llvm-objcopy" \ | ||
"$RUST_BIN/rustc" \ | ||
"$RUST_BIN/rustdoc" \ | ||
"$RUST_BIN/cargo" \ | ||
"$RUST_LIB/librustc_driver-b4e91886a4c059a0.dylib" \ | ||
"$RUST_LIB/libstd-6eff127b55c063c2.dylib" \ | ||
"$RUST_LIB/libtest-090d77c63b6e9f11.dylib"\ | ||
|
||
fi | ||
|
||
# Check the Rust binaries | ||
while IFS= read -r f | ||
do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
FILES_TO_SIGN=$@ | ||
|
||
for FILE_PATH in $FILES_TO_SIGN; do | ||
FILE_NAME=$(basename $FILE_PATH) | ||
APPLE_TEMPKEYCHAIN_NAME=$(echo $FILE_NAME | tr -cd 'a-zA-Z')$(($RANDOM)) # use a random name | ||
|
||
echo "File path: $FILE_PATH" | ||
echo "File name: $FILE_NAME" | ||
echo "Apple temp keychain name: $APPLE_TEMPKEYCHAIN_NAME" | ||
|
||
# create keychain | ||
printf "$APPLE_P12_BASE64" | base64 -d > dev.p12 | ||
security create-keychain -p "$APPLE_TEMPKEYCHAIN_PASSWORD" "$APPLE_TEMPKEYCHAIN_NAME" | ||
security list-keychains -d user -s "$APPLE_TEMPKEYCHAIN_NAME" $(security list-keychains -d user | tr -d '"') | ||
security set-keychain-settings "$APPLE_TEMPKEYCHAIN_NAME" | ||
security import dev.p12 -k "$APPLE_TEMPKEYCHAIN_NAME" -P "$APPLE_P12_PASSWORD" -T "/usr/bin/codesign" | ||
security set-key-partition-list -S apple-tool:,apple: -s -k "$APPLE_TEMPKEYCHAIN_PASSWORD" -D "$APPLE_CODESIGN_IDENTITY" -t private "$APPLE_TEMPKEYCHAIN_NAME" | ||
security default-keychain -d user -s "$APPLE_TEMPKEYCHAIN_NAME" | ||
security unlock-keychain -p "$APPLE_TEMPKEYCHAIN_PASSWORD" "$APPLE_TEMPKEYCHAIN_NAME" | ||
|
||
# sign the binary | ||
codesign -o runtime --force --timestamp -s "$APPLE_CODESIGN_IDENTITY" -v $FILE_PATH | ||
|
||
# notarize binary | ||
ditto -c -k $FILE_PATH $FILE_NAME.zip # notarization require zip files | ||
xcrun notarytool store-credentials --apple-id [email protected] --password "$APPLE_CRED" --team-id "$APPLE_TEAMID" altool | ||
xcrun notarytool submit $FILE_NAME.zip --keychain-profile altool --wait | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is
cargo update
needed? This will updateCargo.lock
, leading to inconsistent builds. It is strange if it was required for the CI but not for me locally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it was required by the ci.
this is the error from the ci build:
maybe we can replace cargo update with just updating
time
crate version ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I remember getting this error. The issue is that we are compiling old
cargo
using newcargo
and there some library no longer works. The proper fix is to updatetime
package to newer version and apply patch toCargo.lock
. I have to do it locally, check that it works, and then commit the patch to the repo.Current workaround of calling
cargo update
each time is ok for now