fmt #104
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: CI | |
on: [push, pull_request] | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: ⚙️ Create issues from TODO comments | |
uses: ribtoks/tdg-github-action@master | |
with: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: ${{ github.repository }} | |
SHA: ${{ github.sha }} | |
REF: ${{ github.ref }} | |
- name: ⚙️ Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
components: rustfmt | |
- name: ⚙️ Check formatting | |
run: cargo fmt --all -- --check | |
build: | |
name: Build for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [linux, windows, macos] | |
include: | |
- platform: linux | |
os: ubuntu-latest | |
artifact_name: gyromouse | |
asset_name: gyromouse-linux | |
release_name: gyromouse-linux.7z | |
- platform: windows | |
os: windows-latest | |
artifact_name: gyromouse.exe | |
asset_name: gyromouse-windows | |
release_name: gyromouse-windows.7z | |
- platform: macos | |
os: macos-latest | |
artifact_name: gyromouse | |
asset_name: gyromouse-macos | |
release_name: gyromouse-macos.7z | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: ⚙️ Install clippy | |
run: rustup component add clippy | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
key: v5 | |
- name: ⚙️ Install cargo-vcpkg | |
run: cargo vcpkg --version || cargo install cargo-vcpkg | |
# Ubuntu build deps for SDL | |
# https://hg.libsdl.org/SDL/file/default/docs/README-linux.md | |
- name: ⚙️ Install OS dependencies | |
if: matrix.platform == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install build-essential git make cmake autoconf automake \ | |
libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \ | |
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev \ | |
libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \ | |
libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \ | |
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \ | |
libxkbcommon-dev libdrm-dev libgbm-dev \ | |
\ | |
libusb-1.0-0-dev libxdo-dev libbluetooth-dev libudev-dev libxtst-dev | |
- name: 🔨 Build SDL | |
uses: actions-rs/cargo@v1 | |
with: | |
command: vcpkg | |
args: --verbose build | |
#- name: dbg sdl | |
# if: matrix.platform == 'linux' | |
# run: | | |
# cp -f target/vcpkg/installed/x64-linux/*/lib/libSDL2d.a target/vcpkg/installed/x64-linux/lib/libSDL2.a | |
# cp -f target/vcpkg/installed/x64-linux/*/lib/libSDL2maind.a target/vcpkg/installed/x64-linux/lib/libSDL2main.a | |
# continue-on-error: true | |
- name: 🔨 Build gyromouse | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --verbose --release --features sdl2-static | |
- name: ⚙️ Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --release --features sdl2-static | |
- name: ⚙️ Clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: ☁️ Upload gyromouse | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.asset_name }} | |
path: target/release/${{ matrix.artifact_name }} | |
- name: ⚙️ Prepare Release archives | |
shell: bash | |
run: | | |
mkdir gyromouse | |
cp -r target/release/${{ matrix.artifact_name }} mappings README.md CHANGELOG.md gyromouse/ | |
7z a ${{ matrix.release_name }} gyromouse | |
- name: ☁️ Create Release (tag) | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
discussion_category_name: Release | |
files: ${{ matrix.release_name }} | |
- name: ☁️ Create Release (nightly) | |
if: github.ref == 'refs/heads/master' && matrix.platform == 'linux' | |
uses: eine/tip@master | |
with: | |
tag: nightly | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ${{ matrix.release_name }} |