Skip to content
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

back port #234 to v0.9 #314

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Crates

on:
release:
types: [created]
workflow_dispatch:
inputs:
crate_name:
description: 'Name of crate to be published'
required: true
type: string
permissions:
contents: read

jobs:
crate_publish:
environment: "publish to crates.io"
runs-on: ubuntu-latest
steps:
- 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
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"
107 changes: 107 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI

on:
push:
branches:
- 'v0.*'
- staging
- trying
pull_request:
branches:
- master
- 'v0.*'
merge_group:

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10

jobs:
test:
name: Test
strategy:
matrix:
include:
- rust: stable
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- rust: stable
target: x86_64-fortanix-unknown-sgx
os: ubuntu-20.04
- rust: stable
target: x86_64-pc-windows-msvc
os: windows-latest
- rust: stable
target: x86_64-pc-windows-msvc
os: windows-latest
- rust: stable
target: x86_64-pc-windows-msvc
os: windows-2019
- rust: stable
target: aarch64-unknown-linux-musl
os: ubuntu-20.04
- rust: beta
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- rust: nightly
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Install qemu-user for aarch64 target
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y qemu-user

- name: Install clang-11 on windows-2019
if: matrix.os == 'windows-2019'
uses: KyleMayes/install-llvm-action@v1
with:
version: "11.0"

- name: Cache Dependencies
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
with:
key: ${{ matrix.rust }}

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true

- name: Run tests
run: |
# Set LIBCLANG_PATH for bindgen to access clang library under windows-2019
if [ "$MATRIX_OS" == "windows-2019" ]; then
export LIBCLANG_PATH="C:\Program Files\LLVM\bin"
echo "$LIBCLANG_PATH"
fi
./ci_tools.sh
./ci.sh
env:
TRAVIS_RUST_VERSION: ${{ matrix.rust }}
TARGET: ${{ matrix.target }}
MATRIX_OS: ${{ matrix.os }}
ZLIB_INSTALLED: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }}
AES_NI_SUPPORT: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }}
shell: bash

ci-success:
name: ci
if: always()
needs:
- test
runs-on: ubuntu-20.04
steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- name: Done
run: exit 0
47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

Loading