Update workflow #118
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
--- | |
# Main "useful" actions config file | |
# Cache config comes from https://github.com/actions/cache/blob/main/examples.md#rust---cargo | |
# actions-rs/toolchain configures rustup | |
# actions-rs/cargo actually runs cargo | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
name: Rust Validation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
RUSTFLAGS: -D warnings --cfg uuid_unstable -C debuginfo=1 | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
check: | |
name: "Check (cargo check)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/[email protected] | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all-features --all-targets -- -D warnings | |
- run: cargo clippy --no-default-features --all-targets -- -D warnings | |
test: | |
strategy: | |
fail-fast: true | |
matrix: | |
# os: [ubuntu-latest] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
# - build: macos | |
# os: macos-latest | |
# target: x86_64-apple-darwin | |
# extension: '' | |
- build: windows-msvc | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
name: "Test on ${{ matrix.os }} (cargo test)" | |
runs-on: ${{ matrix.os }} | |
env: | |
MYSQLCLIENT_LIB_DIR: C:\mysql\lib | |
steps: | |
- uses: actions/checkout@v2 | |
- name: List files | |
run: | | |
pwd | |
ls | |
- uses: dtolnay/[email protected] | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test | |
integration: | |
name: "Integration testing (docker)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
id: cache-docker | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Image | |
uses: docker/build-push-action@v3 | |
with: | |
load: true | |
tags: mdb-example-so:latest | |
file: Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Start docker | |
run: > | |
docker run --rm -d | |
-p 12305:3306 | |
-e MARIADB_ROOT_PASSWORD=example | |
--name mdb-udf-suite-container | |
mdb-example-so | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Run integration testing | |
# Run only integration tests with `--test '*'` | |
run: cargo test -p test-integration --test '*' --features backend | |
- name: Print docker logs | |
if: always() | |
run: | | |
docker logs mdb-udf-suite-container | |
# If any critical / debug options were printed, error out | |
docker logs mdb-udf-suite-container 2>&1 | grep -E '\[(Critical|Error)\]' || exit 0 && exit 1; | |
docker stop mdb-udf-suite-container | |
miri: | |
name: Miri | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: miri | |
- uses: Swatinem/rust-cache@v2 | |
- env: | |
# Can't use chrono for time in isolation | |
MIRIFLAGS: -Zmiri-disable-isolation | |
run: cargo miri test | |
fmt: | |
name: "Format (cargo fmt)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
- uses: actions/setup-python@v3 | |
- name: Validate pre-commit | |
uses: pre-commit/[email protected] | |
doc: | |
name: "Docs (cargo doc)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo doc | |
outdated: | |
name: Outdated | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/install@cargo-outdated | |
- run: cargo outdated --workspace --exit-code 1 --ignore lipsum | |
security_audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: rustsec/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |