-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial CI jobs for Rust build (#28)
* Modernize Rust syntax to 2018 edition and fix many lint warnings * Correct full namespaces of imports * Don't import things that aren't used (yet) * Use `_` prefix for private / unused values (should be refactored back to regular names on a case by cases basis as they are used & made public) * Order and space according to rustfmt The bulk of this work was done by: cargo +nightly fix --edition * Explicitly parse Rust as latest syntax edition (default is 2015) * Fix coding style with `rustfmt` * Correct bogus file extension, .rs → .sh * Add CI jobs to lint, validate, build, & test Rust code * Track Cargo lock file (this is correct Rust+VCS usage) * Install GTK and libxcb devel headers into CI environment
- Loading branch information
Showing
26 changed files
with
2,176 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Rust | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Fetch tags | ||
run: git fetch --tags | ||
- name: Setup system dependencies | ||
run: sudo apt-get install libgtk-3-dev libxcb-shape0-dev libxcb-xfixes0-dev | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: clippy | ||
- name: Cache cargo registry | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/registry | ||
key: build-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo index | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/git | ||
key: build-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo build | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: build-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Run cargo build | ||
run: | | ||
cargo build --locked | ||
- name: Run cargo test | ||
run: | | ||
cargo test --locked | ||
rustfmt: | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt | ||
- name: Run rustfmt | ||
run: | | ||
git ls-files '*.rs' | xargs rustfmt --check | ||
cargo_bloat: | ||
if: false | ||
strategy: | ||
fail-fast: false | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
- name: Cache cargo registry | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/registry | ||
key: bloat-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo index | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/git | ||
key: bloat-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo build | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: bloat-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Run cargo bloat | ||
uses: orf/cargo-bloat-action@v1 | ||
with: | ||
token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/target | ||
Cargo.lock | ||
*.swp |
Oops, something went wrong.