Rewrite github action using the correct run #17
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
name: SDWebImage/librav1e-Xcode | |
on: | |
push: | |
# Pattern matched against refs/tags | |
tags: | |
- '*' | |
env: | |
LC_CTYPE: en_US.UTF-8 | |
LANG: en_US.UTF-8 | |
jobs: | |
build: | |
runs-on: macos-12 | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up cargo cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
rav1e/target | |
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}" | |
- name: Install Rust toolchain | |
uses: actions-rs/[email protected] | |
with: | |
toolchain: 1.51.0 | |
default: true | |
- name: Set up cargo package | |
run: | | |
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-darwin x86_64-apple-darwin | |
cargo install cargo-lipo | |
cargo install cbindgen | |
cargo install cargo-crate-type | |
HOMEBREW_NO_AUTO_UPDATE=1 brew install nasm | |
- name: Clone rav1e | |
run: | | |
cd "${{ github.workspace }}" | |
mkdir include | |
rm -rf rav1e | |
git clone -b "v${{ github.ref_name }}" --depth 1 https://github.com/xiph/rav1e.git | |
- name: Configure rav1e | |
cd "${{ github.workspace }}/rav1e" | |
cbindgen -c cbindgen.toml -l C -o include/rav1e/rav1e.h --crate rav1e . | |
cargo crate-type static | |
# iOS | |
- name: Build iOS | |
run: | | |
cd "${{ github.workspace }}/rav1e" | |
rm -rf "${{ github.workspace }}/rav1e/target" | |
cargo lipo --release --no-default-features --features "asm capi" --targets=aarch64-apple-ios,x86_64-apple-ios | |
cd "${{ github.workspace }}" | |
mkdir -p Build | |
cd Build | |
mkdir iOS | |
cd iOS | |
mkdir librav1e.framework | |
cd librav1e.framework | |
mkdir Headers | |
mkdir Modules | |
cp "${{ github.workspace }}/rav1e/target/universal/release/librav1e.a" librav1e | |
cp "${{ github.workspace }}/rav1e/include/rav1e/rav1e.h" Headers/ | |
cp "${{ github.workspace }}/module.modulemap" Modules/ | |
# MacOS | |
- name: Build macOS | |
run: | | |
cd "${{ github.workspace }}/rav1e" | |
rm -rf "${{ github.workspace }}/rav1e/target" | |
cargo lipo --release --no-default-features --features "asm capi" --targets=aarch64-apple-darwin,x86_64-apple-darwin | |
cd "${{ github.workspace }}" | |
mkdir -p Build | |
cd Build | |
mkdir Mac | |
cd Mac | |
mkdir librav1e.framework | |
cd librav1e.framework | |
mkdir Versions | |
cd Versions | |
mkdir A | |
ln -s A Current | |
cd A | |
mkdir Headers | |
mkdir Modules | |
cp "${{ github.workspace }}/rav1e/target/universal/release/librav1e.a" librav1e | |
cp "${{ github.workspace }}/rav1e/include/rav1e/rav1e.h" Headers/ | |
cp "${{ github.workspace }}/module.modulemap" Modules/ | |
cd ../../ | |
ln -s Versions/Current/librav1e librav1e | |
ln -s Versions/Current/Headers Headers | |
ln -s Versions/Current/Modules Modules | |
# Zip | |
- name: Archive | |
run: | | |
cd "${{ github.workspace }}" | |
cd Build | |
zip -y -r librav1e.zip Mac/ iOS/ | |
- uses: softprops/[email protected] | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
GITHUB_REPOSITORY: "${{ github.repository }}" | |
with: | |
files: "${{ github.workspace }}/Build/librav1e.zip" |