-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a918f71
commit 37efaf8
Showing
1 changed file
with
15 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,32 @@ | ||
# referred from: https://github.com/PyO3/maturin/blob/main/.github/workflows/release.yml | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: [ 'v*' ] | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release-build: | ||
name: Release build | ||
release: | ||
name: release ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-musl | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
- i686-pc-windows-msvc | ||
- aarch64-pc-windows-msvc | ||
include: | ||
- target: x86_64-unknown-linux-musl | ||
os: ubuntu-latest | ||
name: jsdelivr-proxy-x86_64-unknown-linux-musl.tar.gz | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
name: jsdelivr-proxy-x86_64-apple-darwin.tar.gz | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
name: jsdelivr-proxy-x86_64-pc-windows-msvc.zip | ||
- target: i686-pc-windows-msvc | ||
os: jsdelivr-proxy-latest | ||
name: jsdelivr-proxy-i686-pc-windows-msvc.zip | ||
- target: aarch64-pc-windows-msvc | ||
os: windows-latest | ||
name: jsdelivr-proxy-aarch64-pc-windows-msvc.zip | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
# Largely inspired by https://github.com/starship/starship/blob/35a0a20f5c4fea6a08e1b91ff631b089eef8fc50/.github/workflows/deploy.yml | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@master | ||
- name: Install latest nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
toolchain: nightly | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: Install musl tools | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt-get install -y musl-tools | ||
|
||
# Install gnu-tar because BSD tar is buggy | ||
# https://github.com/actions/cache/issues/403 | ||
- name: Install GNU tar (macOS) | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
brew install gnu-tar | ||
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH | ||
# Those two will also create target/${{ matrix.target }}/maturin | ||
- name: Build wheel (with sdist) | ||
if: matrix.target == 'x86_64-unknown-linux-musl' | ||
run: | | ||
cargo run -- build --release -b bin -o dist --target ${{ matrix.target }} --compatibility manylinux2010 musllinux_1_1 | ||
# ring doesn't support aarch64 windows yet | ||
- name: Build wheel (windows aarch64) | ||
if: matrix.target == 'aarch64-pc-windows-msvc' | ||
run: cargo run -- build --release -b bin -o dist --target ${{ matrix.target }} --no-sdist | ||
|
||
- name: Build wheel (without sdist) | ||
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' && matrix.target != 'aarch64-pc-windows-msvc' }} | ||
run: cargo run -- build --release -b bin -o dist --target ${{ matrix.target }} --no-sdist | ||
|
||
- name: Build wheel (macOS universal2) | ||
if: matrix.target == 'x86_64-apple-darwin' | ||
components: rustfmt, clippy | ||
- name: Compile and release | ||
uses: rust-build/[email protected] | ||
env: | ||
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer | ||
MACOSX_DEPLOYMENT_TARGET: '10.9' | ||
run: | | ||
# set SDKROOT for C dependencies like ring and bzip2 | ||
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) | ||
rustup target add aarch64-apple-darwin | ||
cargo run -- build --release -b bin -o dist --no-sdist --universal2 | ||
- name: Archive binary (windows) | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
7z a ../../../${{ matrix.name }} ${{ github.event.repository.name }}.exe | ||
cd - | ||
- name: Archive binary (linux and macOS) | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
tar czvf ../../../${{ matrix.name }} ${{ github.event.repository.name }} | ||
cd - | ||
- name: Archive binary (macOS aarch64) | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
cd target/aarch64-apple-darwin/release | ||
tar czvf ../../../jsdelivr-proxy-aarch64-apple-darwin.tar.gz ${{ github.event.repository.name }} | ||
cd - | ||
- name: Upload wheel artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
- name: Upload binary artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binaries | ||
path: | | ||
*.tar.gz | ||
*.zip | ||
*.deb | ||
release-musl: | ||
name: Release musl build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ | ||
{ target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl", manylinux: "2014" }, | ||
{ target: "armv7-unknown-linux-musleabihf", image_tag: "armv7-musleabihf", manylinux: "2014"}, | ||
{ target: "i686-unknown-linux-musl", image_tag: "i686-musl", manylinux: "2010"}, | ||
] | ||
container: | ||
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }} | ||
env: | ||
RUSTUP_HOME: /root/.rustup | ||
CARGO_HOME: /root/.cargo | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build wheel | ||
run: | | ||
sudo python3 -m pip install maturin | ||
maturin build --release -b bin -o dist --no-sdist \ | ||
--target ${{ matrix.platform.target }} \ | ||
--manylinux ${{ matrix.platform.manylinux }} musllinux_1_1 | ||
- name: Archive binary | ||
run: tar czvf target/release/jsdelivr-proxy-${{ matrix.platform.target }}.tar.gz -C target/${{ matrix.platform.target }}/release jsdelivr-proxy | ||
- name: Upload wheel artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
- name: Upload binary artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binaries | ||
path: target/release/jsdelivr-proxy-${{ matrix.platform.target }}.tar.gz | ||
release-github: | ||
name: Publish to GitHub releases | ||
runs-on: ubuntu-latest | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: [ release-build, release-musl ] | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: binaries | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: | | ||
*.tar.gz | ||
*.zip | ||
*.deb | ||
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | ||
generate_release_notes: true | ||
RUSTTARGET: ${{ matrix.target }} | ||
EXTRA_FILES: "README.md LICENSE config.example.toml" |