Rust #863
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: | |
workflow_dispatch: | |
inputs: | |
RUST_TOOLCHAIN: | |
description: RUST_TOOLCHAIN (stable or 1.73) | |
default: "1.73" | |
required: true | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
paths-ignore: | |
- 'README.md' | |
- '.github/**' | |
branches: [ master ] | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
- '.github/**' | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
VCPKG_COMMIT_ID: 06c79a9afa6f99f02f44d20df9e0848b2a56bf1b | |
TAG_NAME: latest | |
VERSION: "1.1.2" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macOS-latest] | |
include: | |
- name: linux | |
os: ubuntu-20.04 | |
artifact_name: target/release/RustPlayer | |
asset_name: RustPlayer-linux-amd64 | |
- name: macos | |
os: macOS-latest | |
artifact_name: target/release/RustPlayer | |
asset_name: RustPlayer-macos | |
steps: | |
- uses: actions/checkout@v2 | |
- name: patch dynamic build | |
run: git apply dynamic-lib.patch | |
- run: rustup toolchain install ${{ inputs.RUST_TOOLCHAIN }} --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
- name: install deps for linux | |
if: matrix.os == 'ubuntu-20.04' | |
run: sudo apt update && sudo apt install -y libasound2-dev libavcodec-dev libavformat-dev libswresample-dev libavutil-dev libavformat-dev pkg-config | |
- name: install ffmpeg deps for macOS | |
if: matrix.os == 'macOS-latest' | |
run: brew install ffmpeg pkg-config && brew link ffmpeg | |
- name: Install cargo bundle | |
if: matrix.os == 'ubuntu-20.04' | |
shell: bash | |
run: | | |
pushd /tmp | |
git clone https://github.com/KetaDotCC/cargo-bundle | |
pushd cargo-bundle | |
cargo install --path . | |
popd | |
popd | |
- name: build RustPlayer for macOS | |
if: matrix.os == 'macOS-latest' | |
run: cargo build --release | |
- name: build RustPlayer for Linux | |
if: matrix.os == 'ubuntu-20.04' | |
run: cargo bundle --release | |
- name: bundle RustPlayer for macOS | |
if: matrix.os == 'macOS-latest' | |
run: | | |
# npm install --global create-dmg | |
# for name in target/release/bundle/osx/*.app; do | |
# create-dmg $name || true | |
# done | |
mv target/release/rustplayer rustplayer-binary-macos | |
- name: Publish Release for linux | |
if: matrix.os == 'ubuntu-20.04' | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: ${{ env.TAG_NAME }} | |
files: | | |
target/release/bundle/deb/*.deb | |
- name: Publish Release for macos | |
if: matrix.os == 'macOS-latest' | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: ${{ env.TAG_NAME }} | |
files: | | |
rustplayer-binary-macos | |
build-on-windows: | |
runs-on: windows-latest | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { sys: mingw64, env: x86_64, artifact_name: target/release/RustPlayer.exe , asset_name: RustPlayer-windows-x86_64.exe } | |
# - { sys: mingw32, env: i686, artifact_name: target/release/RustPlayer.exe , asset_name: RustPlayer-windows-x86.exe } | |
# - { sys: ucrt64, env: ucrt-x86_64 } # Experimental! | |
# - { sys: clang64, env: clang-x86_64 } # Experimental! | |
# defaults: | |
# run: | |
# shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: rustup toolchain install ${{ inputs.RUST_TOOLCHAIN }} --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
- name: setup vcpkg (do not install any package) | |
uses: lukka/run-vcpkg@v10 | |
with: | |
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} | |
- name: build RustPlayer | |
shell: bash | |
run: | | |
$VCPKG_ROOT/vcpkg install ffmpeg:x64-windows-static-md | |
cargo build --release | |
- name: rename | |
shell: bash | |
run: | | |
mv target/release/rustplayer.exe target/release/rustplayer-${{ env.VERSION }}.exe | |
- name: Publish Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: ${{ env.TAG_NAME }} | |
files: | | |
target/release/rustplayer*.exe | |