120 lines
3.0 KiB
YAML
120 lines
3.0 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
paths:
|
|
- Cargo.toml
|
|
- Cargo.lock
|
|
- lapce-**
|
|
- .github/workflows/ci.yml
|
|
workflow_dispatch:
|
|
|
|
name: CI
|
|
|
|
concurrency:
|
|
group: ${{ github.ref }}-${{ github.workflow }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
build:
|
|
name: Rust on ${{ matrix.os }}
|
|
if: github.event.pull_request.draft == false
|
|
needs: [fmt, clippy]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
|
|
- name: Install dependencies on Ubuntu
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: sudo make ubuntu-deps
|
|
|
|
- name: Update toolchain
|
|
run: |
|
|
rustup update --no-self-update
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
|
|
|
|
- name: Fetch dependencies
|
|
run: cargo fetch --locked
|
|
|
|
- name: Build
|
|
run: cargo build --profile ci --frozen
|
|
|
|
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
|
|
with:
|
|
name: lapce-${{ matrix.os }}
|
|
path: |
|
|
target/ci/lapce*
|
|
retention-days: 1
|
|
|
|
- name: Build as portable
|
|
if: startsWith(matrix.os, 'windows')
|
|
run: cargo build --profile ci --frozen --features lapce-app/portable
|
|
|
|
- name: Free space on Windows
|
|
if: startsWith(matrix.os, 'windows')
|
|
run: cargo clean
|
|
|
|
- name: Run doc tests
|
|
run: cargo test --profile ci --doc --workspace
|
|
|
|
fmt:
|
|
name: Formatting and spellchecking
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
|
|
- name: Update toolchain & add rustfmt
|
|
run: |
|
|
rustup update
|
|
rustup component add rustfmt
|
|
|
|
- name: Run rustfmt
|
|
run: cargo fmt --all --check
|
|
|
|
- name: Spell Check Repo
|
|
uses: crate-ci/typos@02ea592e44b3a53c302f697cddca7641cd051c3d
|
|
|
|
clippy:
|
|
name: Clippy on ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
|
|
- name: Update toolchain & add clippy
|
|
run: |
|
|
rustup update --no-self-update
|
|
rustup component add clippy
|
|
|
|
- name: Install dependencies on Ubuntu
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: sudo make ubuntu-deps
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
|
|
|
|
- name: Fetch dependencies
|
|
run: cargo fetch --locked
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --profile ci
|