-
Notifications
You must be signed in to change notification settings - Fork 84
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
Improve CI #296
Improve CI #296
Changes from 4 commits
b3ae629
68e8244
c12f54f
b053769
f639448
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 |
---|---|---|
|
@@ -4,7 +4,11 @@ on: | |
release: | ||
types: [created] | ||
workflow_dispatch: | ||
|
||
inputs: | ||
crate_name: | ||
description: 'Name of crate to be published' | ||
required: true | ||
type: string | ||
permissions: | ||
contents: read | ||
|
||
|
@@ -13,24 +17,42 @@ jobs: | |
environment: "publish to crates.io" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install dependencies | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal | ||
- name: Install build dependencies | ||
run: | | ||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | sudo tee -a /etc/apt/sources.list | ||
sudo apt-get update | ||
sudo apt-get install -y clang-11 cmake | ||
- name: Symlink libclang.so | ||
run: sudo ln -s /lib/x86_64-linux-gnu/libclang-11.so.1 /lib/x86_64-linux-gnu/libclang.so | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- run: | | ||
export crate_name=$(python3 -c "print('$GITHUB_REF'.split('/')[2].rsplit('_v', 1)[0])") | ||
echo "Publishing crate: $crate_name" | ||
cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} --package "$crate_name" | ||
# Create a symbolic link to ensure correct usage of libclang | ||
sudo ln -s /lib/x86_64-linux-gnu/libclang-11.so.1 /lib/x86_64-linux-gnu/libclang.so | ||
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. Since the .so needs to be there, just possibly not in the location where it's being looked for, can this be fixed by adding the appropriate directory to the search path for the linker and/or setting LD_LIBRARY_PATH when whatever needs this library is being run? Adding symlinks to standard system locations seems like not a good idea for a build/test system to be doing. 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. removed |
||
if [ -f mbedtls-sys/vendor/scripts/basic.requirements.txt ]; then | ||
sudo apt-get install -y python3-pip | ||
python3 -m pip install -r mbedtls-sys/vendor/scripts/basic.requirements.txt | ||
fi | ||
- name: Get name of crate to be published | ||
run: | | ||
if [[ -z "${{ inputs.crate_name }}" ]]; then | ||
# Extract the crate name from the GITHUB_REF environment variable | ||
# GITHUB_REF contains the GitHub reference (e.g., refs/tags/mbedtls-sys-auto_v3.5.0) associated with the event | ||
export CRATE_NAME=$(python3 -c "print('$GITHUB_REF'.split('/')[2].rsplit('_v', 1)[0])") | ||
else | ||
export CRATE_NAME="${{ inputs.crate_name }}" | ||
fi | ||
echo "CRATE_NAME=$CRATE_NAME" >> $GITHUB_ENV | ||
- name: Publish crate to crates.io | ||
run: | | ||
echo "Publishing crate: $CRATE_NAME" | ||
cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} --package "$CRATE_NAME" | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
RUSTFLAGS: "-A ambiguous_glob_reexports" | ||
RUST_BACKTRACE: "1" | ||
PYTHONDONTWRITEBYTECODE: "1" |
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.
Unit tests really shouldn't rely on external services, especially ones that might rate limit us. Can this test be changed so it runs its own server locally that the test can make requests to? Ideally, the server should use a different network implementation, so something like python.
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.
Make sense.
Created an issue for this: #297