2021-10-12 04:36:45 +08:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
# env:
|
|
|
|
# MIN_SUPPORTED_RUST_VERSION: "1.46.0"
|
|
|
|
# CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# ensure_cargo_fmt:
|
|
|
|
# name: Ensure 'cargo fmt' has been run
|
|
|
|
# runs-on: ubuntu-20.04
|
|
|
|
# steps:
|
|
|
|
# - uses: actions-rs/toolchain@v1
|
|
|
|
# with:
|
|
|
|
# toolchain: stable
|
|
|
|
# default: true
|
|
|
|
# profile: minimal
|
|
|
|
# components: rustfmt
|
|
|
|
# - uses: actions/checkout@v2
|
|
|
|
# - run: cargo fmt -- --check
|
|
|
|
|
|
|
|
# min_version:
|
|
|
|
# name: Minimum supported rust version
|
|
|
|
# runs-on: ubuntu-20.04
|
|
|
|
# steps:
|
|
|
|
# - name: Checkout source code
|
|
|
|
# uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
|
|
|
# uses: actions-rs/toolchain@v1
|
|
|
|
# with:
|
|
|
|
# toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
|
|
|
# default: true
|
|
|
|
# profile: minimal # minimal component installation (ie, no documentation)
|
|
|
|
# components: clippy
|
|
|
|
# - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
|
|
|
# uses: actions-rs/cargo@v1
|
|
|
|
# with:
|
|
|
|
# command: clippy
|
|
|
|
# args: --locked --all-targets --all-features -- --allow clippy::unknown_clippy_lints
|
|
|
|
# - name: Run tests
|
|
|
|
# uses: actions-rs/cargo@v1
|
|
|
|
# with:
|
|
|
|
# command: test
|
|
|
|
# args: --locked
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
|
|
|
|
runs-on: ${{ matrix.job.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
job:
|
|
|
|
# - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
|
|
|
# - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true }
|
|
|
|
# - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
|
|
|
|
# - { target: i686-pc-windows-msvc , os: windows-2019 }
|
|
|
|
# - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
|
|
|
|
# - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
|
|
|
# - { target: x86_64-apple-darwin , os: macos-10.15 }
|
|
|
|
# - { target: x86_64-pc-windows-gnu , os: windows-2019 }
|
|
|
|
# - { target: x86_64-pc-windows-msvc , os: windows-2019 }
|
|
|
|
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
|
|
|
|
# - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
|
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install prerequisites
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
case ${{ matrix.job.target }} in
|
2022-09-12 13:06:58 +08:00
|
|
|
x86_64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev;;
|
2021-10-12 04:36:45 +08:00
|
|
|
# arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
|
|
|
# aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
- name: Restore from cache and install vcpkg
|
|
|
|
uses: lukka/run-vcpkg@v7
|
|
|
|
with:
|
|
|
|
setupOnly: true
|
2021-10-12 04:40:06 +08:00
|
|
|
vcpkgGitCommitId: '1d4128f08e30cec31b94500840c7eca8ebc579cb'
|
|
|
|
|
|
|
|
- name: Install vcpkg dependencies
|
|
|
|
run: |
|
2021-10-12 04:36:45 +08:00
|
|
|
$VCPKG_ROOT/vcpkg install libvpx libyuv opus
|
2022-09-12 12:50:51 +08:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.job.target }}
|
|
|
|
override: true
|
|
|
|
profile: minimal # minimal component installation (ie, no documentation)
|
2021-10-12 04:36:45 +08:00
|
|
|
|
|
|
|
- name: Show version information (Rust, cargo, GCC)
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
gcc --version || true
|
|
|
|
rustup -V
|
|
|
|
rustup toolchain list
|
|
|
|
rustup default
|
|
|
|
cargo -V
|
|
|
|
rustc -V
|
|
|
|
|
2021-10-12 04:48:56 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
|
2022-09-12 12:50:51 +08:00
|
|
|
- name: Build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
use-cross: ${{ matrix.job.use-cross }}
|
|
|
|
command: build
|
|
|
|
args: --locked --release --target=${{ matrix.job.target }}
|
2021-10-12 04:36:45 +08:00
|
|
|
|
|
|
|
# - name: Strip debug information from executable
|
|
|
|
# id: strip
|
|
|
|
# shell: bash
|
|
|
|
# run: |
|
|
|
|
# # Figure out suffix of binary
|
|
|
|
# EXE_suffix=""
|
|
|
|
# case ${{ matrix.job.target }} in
|
|
|
|
# *-pc-windows-*) EXE_suffix=".exe" ;;
|
|
|
|
# esac;
|
|
|
|
|
|
|
|
# # Figure out what strip tool to use if any
|
|
|
|
# STRIP="strip"
|
|
|
|
# case ${{ matrix.job.target }} in
|
|
|
|
# arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;;
|
|
|
|
# aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;;
|
|
|
|
# *-pc-windows-msvc) STRIP="" ;;
|
|
|
|
# esac;
|
|
|
|
|
|
|
|
# # Setup paths
|
|
|
|
# BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/"
|
|
|
|
# mkdir -p "${BIN_DIR}"
|
|
|
|
# BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}"
|
|
|
|
# BIN_PATH="${BIN_DIR}/${BIN_NAME}"
|
|
|
|
|
|
|
|
# # Copy the release build binary to the result location
|
|
|
|
# cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}"
|
|
|
|
|
|
|
|
# # Also strip if possible
|
|
|
|
# if [ -n "${STRIP}" ]; then
|
|
|
|
# "${STRIP}" "${BIN_PATH}"
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# # Let subsequent steps know where to find the (stripped) bin
|
|
|
|
# echo ::set-output name=BIN_PATH::${BIN_PATH}
|
|
|
|
# echo ::set-output name=BIN_NAME::${BIN_NAME}
|
|
|
|
|
|
|
|
- name: Set testing options
|
|
|
|
id: test-options
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
# test only library unit tests and binary for arm-type targets
|
|
|
|
unset CARGO_TEST_OPTIONS
|
|
|
|
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
|
|
|
|
echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
|
|
|
|
2021-10-12 05:35:31 +08:00
|
|
|
- name: Build tests
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
use-cross: ${{ matrix.job.use-cross }}
|
|
|
|
command: build
|
|
|
|
args: --locked --tests --target=${{ matrix.job.target }}
|
|
|
|
|
2021-10-12 05:09:13 +08:00
|
|
|
# - name: Run tests
|
|
|
|
# uses: actions-rs/cargo@v1
|
|
|
|
# with:
|
|
|
|
# use-cross: ${{ matrix.job.use-cross }}
|
|
|
|
# command: test
|
2021-10-21 10:00:53 +08:00
|
|
|
# args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
|