Add build and CI workflows

This commit is contained in:
0x192 2021-10-10 04:34:47 +02:00
commit 57dc863a7e
No known key found for this signature in database
GPG key ID: 34D27465928A0A1D
2 changed files with 172 additions and 0 deletions

65
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,65 @@
name: Build
on:
push:
tags:
- '*'
jobs:
publish:
name: Building ${{ matrix.build_target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_target: [linux, macos, windows]
include:
- build_target: linux
os: ubuntu-latest
- build_target: macos
os: macos-latest
- build_target: windows
os: windows-latest
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
target: ${{ matrix.target }}
profile: minimal
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get -qq update
sudo apt-get install -y libxkbcommon-dev lld
- uses: actions/checkout@v2
- name: Cargo build (WGPU feature)
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Renaming
if: matrix.os == 'windows-latest'
run: mv target/release/uad_gui.exe target/release/uad_gui-${{ matrix.build_target }}.exe
- name: Renaming
if: matrix.os != 'windows-latest'
run: mv target/release/uad_gui target/release/uad_gui-${{ matrix.build_target }}
- name: Cargo build (Glow feature)
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features glow
- name: Renaming
if: matrix.os == 'windows-latest'
run: mv target/release/uad_gui.exe target/release/uad_gui-${{ matrix.build_target }}-opengl.exe
- name: Renaming
if: matrix.os != 'windows-latest'
run: mv target/release/uad_gui target/release/uad_gui-${{ matrix.build_target }}-opengl
- name: Create pre-release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ github.workspace }}/CHANGELOG.md
files: target/release/uad_gui-*
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

107
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,107 @@
name: Continuous Integration
on:
push:
paths:
- '**.rs'
- 'Cargo.lock'
- 'Cargo.toml'
pull_request:
paths:
- '**.rs'
- 'Cargo.lock'
- 'Cargo.toml'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt -qq update
sudo apt install -y lld
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-check-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt -qq update
sudo apt install -y libxkbcommon-dev lld
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt -qq update
sudo apt install -y lld
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings