Skip to content

chore(deps): bump taiki-e/install-action in the github-actions group #340

chore(deps): bump taiki-e/install-action in the github-actions group

chore(deps): bump taiki-e/install-action in the github-actions group #340

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
env:
RUST_BACKTRACE: 1
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Stable toolchain with rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Check coding style
run: cargo fmt --check --all
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Stable toolchain with clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Lint
run: cargo clippy --all-targets --all-features -- -D warnings
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RUSTDOCFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- run: cargo doc --no-deps
tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- uses: taiki-e/install-action@dea01ef82668860268124c141f462e3f92ef86ff # v2.42.32
with:
tool: cargo-nextest
- name: Test
run: cargo nextest run --all-features --lib --bins --test keys
ctf-challenges:
name: CTF challenges
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- uses: taiki-e/install-action@dea01ef82668860268124c141f462e3f92ef86ff # v2.42.32
with:
tool: cargo-nextest
- name: Test
run: cargo nextest run --release --all-features --test "ctf_*"
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@nightly
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- uses: taiki-e/install-action@dea01ef82668860268124c141f462e3f92ef86ff # v2.42.32
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Tests
run: cargo llvm-cov nextest --lcov --output-path lcov.info --all-features --lib --bins --test keys
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: lcov.info
flags: rust
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
# msys2 required by rug on windows
- name: Setup msys2 (windows)
uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1
if: matrix.os == 'windows-latest'
with:
install: base-devel pacman-mirrors diffutils m4 make openssl openssl-devel
pacboy: gcc:p rust:p
# Only for windows
- name: Msys2 build (windows)
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: |
cargo build
- name: Build
if: matrix.os != 'windows-latest'
run: cargo build
docker-build:
name: Docker build
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CACHE_VERSION: v1
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: |
/tmp/cache/rsacracker/target
/tmp/cache/cargo/registry
key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }}-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-${{ env.CACHE_VERSION }}-${{ github.job }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@5b6db76d1da5c8b307d5d2e0706d266521b710de # v3.1.2
with:
cache-map: |
{
"/tmp/cache/rsacracker/target": "/usr/src/rsacracker/target",
"/tmp/cache/cargo/registry": "/usr/local/cargo/registry"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
tags: rsacracker:test
outputs: type=docker
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test the Docker image
run: docker run --rm -v $PWD:/data rsacracker:test -n 323 --attack small_prime --factors
publish-crates_io:
name: Publish to crates.io
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [fmt, clippy, docs, tests, ctf-challenges, coverage, build, docker-build]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
publish-docker_hub:
name: Publish to hub.docker.com
runs-on: ubuntu-latest
timeout-minutes: 120
needs: [fmt, clippy, docs, tests, ctf-challenges, coverage, build, docker-build]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
env:
IMAGE_NAME: skyf0l/rsacracker
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
env:
VERSION: v4.40.5
BINARY: yq_linux_amd64
- name: Get package version
id: get_version
run: echo VERSION=$(yq ".package.version" Cargo.toml) >> $GITHUB_OUTPUT
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Setup multi-platform
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
push: true
tags: ${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }},${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64,linux/arm64
release:
name: GitHub Release
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [publish-crates_io, publish-docker_hub]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Create Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
make_latest: "true"