event watcher #176
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 Build | |
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
IMAGE_NAME: solar-screen-brightness | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
include: | |
- os: windows-latest | |
exe_suffix: .exe | |
exe_name: windows | |
- os: ubuntu-latest | |
exe_name: ubuntu20 | |
steps: | |
- if: ${{ matrix.os == 'windows-latest' }} | |
name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 | |
uses: KyleMayes/[email protected] | |
with: | |
version: "11.0" | |
directory: ${{ runner.temp }}/llvm | |
- if: ${{ matrix.os == 'windows-latest' }} | |
name: Set LIBCLANG_PATH | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | |
- if: ${{ matrix.os == 'ubuntu-latest' }} | |
name: Install Ubuntu dependencies | |
run: sudo apt update && sudo apt install -y qtbase5-dev libudev-dev | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Cargo Clippy (App) | |
run: cargo clippy -- -D warnings | |
working-directory: ./app | |
- name: Cargo Test (App) | |
run: cargo test | |
working-directory: ./app | |
- name: Cargo Clippy (Installer) | |
run: cargo clippy -- -D warnings | |
working-directory: ./installer | |
- name: Cargo Test (Installer) | |
run: cargo test | |
working-directory: ./installer | |
- if: ${{ matrix.os == 'windows-latest' }} | |
name: Cargo Clippy (Windows) | |
run: cargo clippy -- -D warnings | |
working-directory: ./windows | |
- if: startsWith(github.ref, 'refs/tags/') | |
name: Compile Release | |
run: cargo build --release | |
working-directory: ./installer | |
- if: startsWith(github.ref, 'refs/tags/') | |
name: Copy Binary | |
run: cp ./installer/target/release/solar-screen-brightness-installer${{ matrix.exe_suffix }} ./installer-${{ matrix.exe_name }}${{ matrix.exe_suffix }} | |
- if: startsWith(github.ref, 'refs/tags/') | |
name: Github Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./installer-${{ matrix.exe_name }}${{ matrix.exe_suffix }} | |
check_style: | |
strategy: | |
matrix: | |
dir: [ app, installer, windows ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cargo Format Check | |
run: cargo fmt -- --check | |
working-directory: ./${{ matrix.dir }} | |
- name: Cargo Sort Check | |
run: cargo install cargo-sort && cargo-sort --check | |
working-directory: ./${{ matrix.dir }} |