Skip to content

Version 0.5.0

Version 0.5.0 #1100

Workflow file for this run

name: Rust
on:
push:
branches: [main, "*.x"]
pull_request:
release:
types: [created]
env:
RUST_BACKTRACE: "1"
RUST_LOG: "info"
# speed up build by using clang/lld
CC: "clang-14"
CXX: "clang++-14"
LD: "clang-14"
LDFLAGS: "-fuse-ld=lld-14"
RUSTFLAGS: "-C linker=clang-14 -C link-arg=-fuse-ld=lld-14"
jobs:
test:
strategy:
fail-fast: false
matrix:
rust:
- toolchain: "stable"
- toolchain: "nightly"
name: "Test (Rust ${{matrix.rust.toolchain}})"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: "${{matrix.rust.toolchain}}"
id: "rust-toolchain"
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
- run: cargo test
- name: cargo run
run: |
cargo run -- --bin
git diff --exit-code README.md
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: ./rustfmt.sh --check
docker:
runs-on: ubuntu-latest
needs: [test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Log In at ghcr.io
run: echo "${{secrets.GITHUB_TOKEN}}" | docker login ghcr.io -u msrd0 --password-stdin
- name: Build and Push image to ghcr.io
run: |
image="ghcr.io/msrd0/cargo-doc2readme"
tag="$image:$(git describe --tags)"
echo "==> Building docker image"
docker build . --pull --tag "$image"
docker tag "$image" "$tag"
echo "==> Pushing docker image"
docker push "$tag"
docker push "$image"