Skip to content

Bump dependencies and update CI #137

Bump dependencies and update CI

Bump dependencies and update CI #137

---
on:
push:
branches:
- main
pull_request:
name: Rust Validation
env:
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: "-D warnings"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
TARGET_DIR: ./target
jobs:
check_test:
strategy:
fail-fast: true
matrix:
include:
- name: linux x64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
native: true
- name: linux aarch
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
native: false
- name: macos x64
os: macos-latest
target: x86_64-apple-darwin
native: true
- name: macos aarch
os: macos-latest
target: aarch64-apple-darwin
native: false
- name: windows msvc
os: windows-latest
target: x86_64-pc-windows-msvc
native: true
- name: windows gnu
os: windows-latest
target: x86_64-pc-windows-gnu
native: true
name: "Check ${{ matrix.name }}. test: ${{ matrix.native }}"
runs-on: ${{ matrix.os }}
env:
MAKE_DIST: "1"
steps:
- uses: actions/checkout@v4
- run: rustup default 1.74 && rustup component add clippy && rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all-features --all-targets --target ${{ matrix.target }} -- -D warnings
- name: Run tests
if: matrix.native
run: cargo test --target ${{ matrix.target }}
- name: Build binary
if: matrix.native && matrix.os != 'windows-latest'
run: cargo build
- name: Test make
if: matrix.native && matrix.os != 'windows-latest'
run: |
cargo_outdir="$(find target -name mpk-stamp -print0 | xargs -0 ls -t | head -n1 | xargs dirname)"
echo outdir: "$cargo_outdir"
compdir_bash="/usr/share/bash-completion/completions"
compdir_fish="/usr/share/fish/vendor_completions.d"
compdir_zsh="/usr/share/zsh/vendor-completions"
mkdir testdir testdir/completion testdir/doc
sh dist/create_install_makefile.sh
mv Makefile.dist testdir/Makefile
mv "$cargo_outdir"/mpk.1 testdir/doc
mv "$cargo_outdir"/* testdir/completion
mv target/debug/mpk testdir
cd testdir
echo -e '\n==== running sudo make install ===='
sudo make install
echo '==== finished install ===='
echo testing files...
echo testing mpk presence...
test -f /usr/local/bin/mpk
echo testing mpk.1 presence...
test -f /usr/local/share/man/man1/mpk.1
if [ -d "$compdir_bash" ]; then
echo testing mpk bash presence...
test -f "${compdir_bash}/mpk"
fi
if [ -d "$compdir_fish" ]; then
echo testing mpk fish presence...
test -f "${compdir_fish}/mpk.fish"
fi
if [ -d "$compdir_zsh" ]; then
echo testing mpk zsh presence...
test -f "${compdir_zsh}/_mpk"
fi
echo -e '\n==== running sudo make uninstall ===='
sudo make uninstall
echo '==== finished uninstall ===='
echo testing mpk removal...
test ! -f /usr/local/bin/mpk
echo testing mpk.1 removal...
test ! -f /usr/local/share/man/man1/mpk.1
if [ -d "$compdir_bash" ]; then
echo testing mpk bash removal...
test ! -f "${compdir_bash}/mpk"
fi
if [ -d "$compdir_fish" ]; then
echo testing mpk fish removal...
test ! -f "${compdir_fish}/mpk.fish"
fi
if [ -d "$compdir_zsh" ]; then
echo testing mpk zsh removal...
test ! -f "${compdir_zsh}/_mpk"
fi
mkdir -p ~/.local
echo -e '\n==== running install with prefix ===='
make install PREFIX="~/local"
echo '==== finished install ===='
echo testing mpk presence...
test -f ~/local/bin/mpk
echo -e '\n==== running uninstall with prefix ===='
make uninstall PREFIX="~/local"
echo '==== finished uninstall ===='
echo testing mpk removal...
test ! -f ~/local/bin/mpk
fmt:
name: "Format (cargo fmt)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly && rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
doc:
name: "Docs (cargo doc)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly
- uses: Swatinem/rust-cache@v2
- run: cargo doc --document-private-items
outdated:
name: Outdated
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: cargo-outdated
- run: cargo outdated --workspace --exit-code 1