-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (94 loc) · 2.8 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Based on: https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
BINNAME: vscode-recent
LIBNAME: librofi_vscode_mode.so
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install common dependencies
run: ci/install-common-deps-ubuntu
- name: Build just the binary
run: cargo build --verbose --bin ${{ env.BINNAME }} --no-default-features
- name: Install rofi dependencies
run: ci/install-rofi-deps-ubuntu
- name: Build everything
run: cargo build --verbose --workspace
- name: Run tests
run: cargo test --verbose --workspace
- name: Lint
run: cargo clippy --all-targets --all-features --tests --all -- -D warnings
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --document-private-items --workspace
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
release:
name: Release
runs-on: ubuntu-latest
needs: [build, rustfmt]
if: |
github.repository == 'fuljo/rofi-vscode-mode' &&
github.ref_type == 'tag' &&
needs.build.result == 'success' &&
needs.rustfmt.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch the whole history, otherwise we can't generate the changelog
fetch-depth: 0
- name: Generate changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: Cargo.toml
# Remove header and footer, print changes for current tag
args: -vv --current --strip header
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: ${{ steps.git-cliff.outputs.changelog }}