Merge pull request #118 from PrivateBin/dependabot/cargo/url-2.5.4 #359
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: Rust test & lint | |
on: | |
push: | |
branches: '*' | |
pull_request: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: | | |
rustup toolchain install 1.70 --profile minimal --no-self-update --component rustfmt clippy | |
rustup default 1.70 | |
- name: Cache GeoIP database | |
id: cache-geoip | |
uses: actions/cache@v4 | |
with: | |
path: var | |
key: static-geoip | |
- name: Download GeoIP database | |
if: steps.cache-geoip.outputs.cache-hit != 'true' | |
run: curl -s https://download.db-ip.com/free/dbip-country-lite-$(date +%Y-%m).mmdb.gz | zcat > var/geoip-country.mmdb | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v4 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Execute all unit and integration tests and build examples | |
run: cargo test -- --test-threads=1 | |
env: | |
GEOIP_MMDB: var/geoip-country.mmdb | |
ROCKET_DATABASES: '{directory={url="var/directory.sqlite"}}' | |
- name: Check formatting of code and suggest improvements | |
run: cargo fmt -- --check | |
- name: Check for common mistakes and code improvements | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
- name: Remove SQLite database, to prevent it getting cached | |
run: rm var/directory.sqlite |