Skip to content

Commit

Permalink
ci: Add Continuous Integration workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fuljo committed Nov 12, 2022
1 parent 91ab22a commit 57326aa
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 3 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Based on: https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml
name: Continuous Integration

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install common dependencies
run: ci/install-common-deps-ubuntu

- name: Install rofi dependencies
run: ci/install-rofi-deps-ubuntu

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Build all crates
# The --workspace refers to all crates in the project
run: cargo build --verbose --workspace

- name: Run tests
run: cargo test --verbose --workspace

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check

docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Install common dependencies
run: ci/install-common-deps-ubuntu

- name: Install rofi dependencies
run: ci/install-rofi-deps-ubuntu

- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --document-private-items --workspace
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.cache/
/target

.devcontainer/
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
keywords = ["rofi", "mode", "plugin", "vscode"]
categories = ["command-line-utilities"]

exclude = ["/ci", "assets/", ".*", "install.sh"]
exclude = ["/ci", "assets/", ".*", "install.sh", "ci"]

[lib]
crate-type = ["lib", "cdylib"]
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# VSCode mode for Rofi

<!-- TODO: badges -->
[![CI Workflow](https://github.com/fuljo/rofi-vscode-mode/actions/workflows/ci.yml/badge.svg)](https://github.com/fuljo/rofi-vscode-mode/actions)


A very handy Rofi menu to open recent Visual Studio Code workspacess and files.

Expand Down Expand Up @@ -58,7 +59,9 @@ When an item is selected, press:
### As a standalone executable
If you prefer something other than Rofi to select your entry, we also provide the `vscode-recent` command that simply writes out the paths line by line. You can then pair it with your favourite selection tool, like [dmenu](https://tools.suckless.org/dmenu/) or [fzf](https://github.com/junegunn/fz).

Please remember that by default the home directory is contracted to a `~`, so you will need to invoke a shell to expand it. Use the `-F` flag to show full paths instead. Use `--help` to show all the options.
Please remember that by default the home directory is contracted to a![example workflow](https://github.com/github/docs/actions/workflows/main.yml/badge.svg)
![example workflow](https://github.com/github/docs/actions/workflows/main.yml/badge.svg)
`~`, so you will need to invoke a shell to expand it. Use the `-F` flag to show full paths instead. Use `--help` to show all the options.

```sh
sh -c "code $(vscode-recent | dmenu)"
Expand Down
13 changes: 13 additions & 0 deletions ci/install-common-deps-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# This script will install just the essential packages to build
# the standalone executable (not the rofi mode)

# A very minimal environment might not contain sudo
if ! command -V sudo; then
apt-get update
apt-get install -y --no-install-recommends sudo
fi
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
pkg-config libsqlite3-dev
10 changes: 10 additions & 0 deletions ci/install-rofi-deps-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# A very minimal environment might not contain sudo
if ! command -V sudo; then
apt-get update
apt-get install -y --no-install-recommends sudo
fi
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
rofi-dev libpango1.0-dev

0 comments on commit 57326aa

Please sign in to comment.