ci: remove cargo-workspaces in favor of cargo #85
Workflow file for this run
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
name: CI | |
on: | |
- push | |
- pull_request | |
- workflow_dispatch | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: '-C debuginfo=0' | |
jobs: | |
Check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Check formatting | |
run: cargo fmt --check | |
- name: Run Clippy | |
run: cargo clippy -- -D warnings | |
Test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Run tests | |
run: cargo test | |
check-published-version: | |
name: Check published version | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- Check | |
- Test | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install gojq | |
run: sudo apt-get install gojq | |
- name: 'Check if crate ${{ inputs.crate }} is published' | |
run: | | |
set -euxo pipefail | |
url="https://raw.githubusercontent.com/rust-lang/crates.io-index/master/ca/tp/catppuccin-egui" | |
published="$(curl -fsSL "$url" | gojq -sr 'map(.vers) | sort | .[-1]')" | |
manifest="$(awk -F \" '/version = / { print $2 }' Cargo.toml)" | |
if [ "$manifest" = "$published" ]; then | |
echo 'new_version=no' >> $GITHUB_OUTPUT | |
else | |
echo 'new_version=yes' >> $GITHUB_OUTPUT | |
fi | |
Publish: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && needs.check-published-version.outputs.new_version == 'yes' | |
environment: crates.io | |
needs: | |
- check-published-version | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Publish crates | |
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} |