Skip to content

Commit cbcc38e

Browse files
bors[bot]Gijs KwakkelTaowyoo
authored
Merge #314
314: back port #234 to v0.9 r=[arushi-pahuja] a=Taowyoo Co-authored-by: Gijs Kwakkel <[email protected]> Co-authored-by: Yuxiang Cao <[email protected]> Co-authored-by: YX Cao <[email protected]>
2 parents 5e1b00a + a9f3ffa commit cbcc38e

File tree

19 files changed

+554
-307
lines changed

19 files changed

+554
-307
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Crates
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
crate_name:
9+
description: 'Name of crate to be published'
10+
required: true
11+
type: string
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
crate_publish:
17+
environment: "publish to crates.io"
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
- name: Install Rust toolchain
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
override: true
27+
profile: minimal
28+
- name: Install build dependencies
29+
run: |
30+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
31+
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | sudo tee -a /etc/apt/sources.list
32+
sudo apt-get update
33+
sudo apt-get install -y clang-11 cmake
34+
if [ -f mbedtls-sys/vendor/scripts/basic.requirements.txt ]; then
35+
sudo apt-get install -y python3-pip
36+
python3 -m pip install -r mbedtls-sys/vendor/scripts/basic.requirements.txt
37+
fi
38+
- name: Get name of crate to be published
39+
run: |
40+
if [[ -z "${{ inputs.crate_name }}" ]]; then
41+
# Extract the crate name from the GITHUB_REF environment variable
42+
# GITHUB_REF contains the GitHub reference (e.g., refs/tags/mbedtls-sys-auto_v3.5.0) associated with the event
43+
export CRATE_NAME=$(python3 -c "print('$GITHUB_REF'.split('/')[2].rsplit('_v', 1)[0])")
44+
else
45+
export CRATE_NAME="${{ inputs.crate_name }}"
46+
fi
47+
echo "CRATE_NAME=$CRATE_NAME" >> $GITHUB_ENV
48+
- name: Publish crate to crates.io
49+
run: |
50+
echo "Publishing crate: $CRATE_NAME"
51+
cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} --package "$CRATE_NAME"
52+
env:
53+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
54+
RUSTFLAGS: "-A ambiguous_glob_reexports"
55+
RUST_BACKTRACE: "1"
56+
PYTHONDONTWRITEBYTECODE: "1"

.github/workflows/test.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'v0.*'
7+
- staging
8+
- trying
9+
pull_request:
10+
branches:
11+
- master
12+
- 'v0.*'
13+
merge_group:
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
CARGO_INCREMENTAL: 0
19+
CARGO_NET_RETRY: 10
20+
21+
jobs:
22+
test:
23+
name: Test
24+
strategy:
25+
matrix:
26+
include:
27+
- rust: stable
28+
target: x86_64-unknown-linux-gnu
29+
os: ubuntu-20.04
30+
- rust: stable
31+
target: x86_64-fortanix-unknown-sgx
32+
os: ubuntu-20.04
33+
- rust: stable
34+
target: x86_64-pc-windows-msvc
35+
os: windows-latest
36+
- rust: stable
37+
target: x86_64-pc-windows-msvc
38+
os: windows-latest
39+
- rust: stable
40+
target: x86_64-pc-windows-msvc
41+
os: windows-2019
42+
- rust: stable
43+
target: aarch64-unknown-linux-musl
44+
os: ubuntu-20.04
45+
- rust: beta
46+
target: x86_64-unknown-linux-gnu
47+
os: ubuntu-20.04
48+
- rust: nightly
49+
target: x86_64-unknown-linux-gnu
50+
os: ubuntu-20.04
51+
52+
runs-on: ${{ matrix.os }}
53+
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- name: Install qemu-user for aarch64 target
58+
if: matrix.target == 'aarch64-unknown-linux-musl'
59+
run: |
60+
sudo apt-get update
61+
sudo apt-get install -y qemu-user
62+
63+
- name: Install clang-11 on windows-2019
64+
if: matrix.os == 'windows-2019'
65+
uses: KyleMayes/install-llvm-action@v1
66+
with:
67+
version: "11.0"
68+
69+
- name: Cache Dependencies
70+
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
71+
with:
72+
key: ${{ matrix.rust }}
73+
74+
- name: Setup Rust toolchain
75+
uses: actions-rs/toolchain@v1
76+
with:
77+
toolchain: ${{ matrix.rust }}
78+
target: ${{ matrix.target }}
79+
override: true
80+
81+
- name: Run tests
82+
run: |
83+
# Set LIBCLANG_PATH for bindgen to access clang library under windows-2019
84+
if [ "$MATRIX_OS" == "windows-2019" ]; then
85+
export LIBCLANG_PATH="C:\Program Files\LLVM\bin"
86+
echo "$LIBCLANG_PATH"
87+
fi
88+
./ci_tools.sh
89+
./ci.sh
90+
env:
91+
TRAVIS_RUST_VERSION: ${{ matrix.rust }}
92+
TARGET: ${{ matrix.target }}
93+
MATRIX_OS: ${{ matrix.os }}
94+
ZLIB_INSTALLED: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }}
95+
AES_NI_SUPPORT: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }}
96+
shell: bash
97+
98+
ci-success:
99+
name: ci
100+
if: always()
101+
needs:
102+
- test
103+
runs-on: ubuntu-20.04
104+
steps:
105+
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
106+
- name: Done
107+
run: exit 0

.travis.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)