Build and Test #4986
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: Build and Test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: '21 2 * * 1-5' # every weekday at 2:21 AM UTC | |
env: | |
CARGO_TERM_COLOR: always | |
GITHUB_REF: ${{ github.ref }} | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
steps: | |
- name: rust-toolchain | |
uses: actions-rs/toolchain@v1.0.6 | |
with: | |
toolchain: stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.7.0 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run unit tests | |
run: make test | |
build-ios: | |
name: Build for iOS targets | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [ x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim ] | |
steps: | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.78 | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.7.0 | |
with: | |
key: "${{ matrix.target }}" | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: false | |
command: build | |
args: --target ${{ matrix.target }} | |
build-android: | |
name: Build for Android targets | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ aarch64-linux-android, armv7-linux-androideabi, i686-linux-android ] | |
steps: | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.78 | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.7.0 | |
with: | |
key: "${{ matrix.target }}" | |
- name: Install Cross | |
run: cargo install cross --locked | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --target ${{ matrix.target }} |