Update rust.yml #315
Workflow file for this run
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: Rust | |
on: | |
push: | |
pull_request: | |
release: | |
types: [released] | |
env: | |
PACKAGES: libavc1394-dev libavdevice-dev | |
jobs: | |
test-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
id: "rust-toolchain" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- uses: msrd0/install-rlottie-action@v1 | |
- run: sudo apt-get update -y && sudo apt-get install -y $PACKAGES | |
- name: install cargo-all-features | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-all-features | |
- run: cargo test-all-features --release -- --include-ignored | |
if: github.event_name != 'pull_request' | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_TEST_THREADS: 1 | |
TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} | |
- run: cargo test-all-features --release | |
if: github.event_name == 'pull_request' | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_TEST_THREADS: 1 | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows, macos] | |
name: "${{ matrix.os }}-test" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
id: "rust-toolchain" | |
- name: install ffmpeg (macos) | |
run: brew install ffmpeg | |
if: ${{ matrix.os == 'macos' }} | |
- name: Install win dependencies | |
# source https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z | |
7z x ffmpeg-release-full-shared.7z | |
mkdir ffmpeg | |
mv ffmpeg-*/* ffmpeg/ | |
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" | |
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" | |
if: ${{ matrix.os == 'windows' }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- run: cargo test --no-default-features --features ffmpeg,log -- --include-ignored | |
if: github.event_name != 'pull_request' | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_TEST_THREADS: 1 | |
TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} | |
- run: cargo test --no-default-features --features ffmpeg,log | |
if: github.event_name == 'pull_request' | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_TEST_THREADS: 1 | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
cargo_publish: | |
if: ${{ github.event_name == 'release' }} | |
needs: [test-linux, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: msrd0/install-rlottie-action@v1 | |
- run: sudo apt-get update -y && sudo apt-get install -y $PACKAGES | |
- uses: msrd0/cargo-publish-action@v1 | |
with: | |
packages: mstickerlib mstickereditor | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |