mirror of https://github.com/lapce/lapce.git
118 lines
3.0 KiB
YAML
118 lines
3.0 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
name: CI
|
|
|
|
jobs:
|
|
build:
|
|
name: Rust (${{ matrix.toolchain }}) on ${{ matrix.os }}
|
|
if: github.event.pull_request.draft == false
|
|
needs: [fmt, clippy]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
toolchain: [ stable ]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install dependencies on Ubuntu
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: sudo apt-get update && sudo apt-get install cmake pkg-config libgtk-3-dev
|
|
|
|
- name: Install latest toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: ${{ matrix.toolchain }}
|
|
override: true
|
|
components: llvm-tools-preview
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
- name: Build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
|
|
- name: Install cargo-llvm-cov
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
name: Run tests and coverage
|
|
with:
|
|
command: llvm-cov
|
|
args: --all-features --workspace --lcov --output-path lcov.info
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
name: Run doc tests
|
|
with:
|
|
command: test
|
|
args: --doc --workspace
|
|
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
files: lcov.info
|
|
|
|
fmt:
|
|
name: Rustfmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install latest toolchain with rustfmt
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt
|
|
|
|
- name: Run rustfmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
clippy:
|
|
name: Clippy (${{ matrix.toolchain }}) on ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
toolchain: [ stable ]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install latest toolchain with clippy
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: ${{ matrix.toolchain }}
|
|
override: true
|
|
components: clippy
|
|
|
|
- name: Install dependencies on Ubuntu
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: sudo apt-get update && sudo apt-get install cmake pkg-config libgtk-3-dev
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
- name: Run clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: -- -D warnings
|