Force sets HEAD to checkout (#183) #647
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: "clippy, rustfmt" | |
- uses: Swatinem/rust-cache@v2 | |
# make sure all code has been formatted with rustfmt | |
- name: check rustfmt | |
run: cargo fmt -- --check --color always | |
# run clippy to verify we have no warnings | |
- run: cargo fetch | |
- name: cargo clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macOS-12] | |
protocol: ["sparse", "git"] | |
runs-on: ${{ matrix.os }} | |
env: | |
CARGO_FETCHER_CRATES_IO_PROTOCOL: ${{ matrix.protocol }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fetch | |
- name: cargo test build | |
run: cargo build --tests --features=gcs | |
- name: cargo test | |
run: cargo test --features=gcs | |
deny-check: | |
name: cargo-deny check | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
publish-check: | |
name: Publish Check | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-unknown-linux-musl | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fetch | |
- name: cargo publish | |
run: cargo publish --dry-run --all-features --target ${{ matrix.target }} | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-22.04 | |
target: aarch64-unknown-linux-musl | |
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
- os: macOS-12 | |
target: x86_64-apple-darwin | |
- os: macOS-12 | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Install musl tools | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt install -y musl-tools | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: cargo fetch | |
run: cargo fetch --target ${{ matrix.target }} | |
- name: Release build | |
run: cargo build --release --target ${{ matrix.target }} --features=gcs,s3,blob | |
- name: Package | |
shell: bash | |
env: | |
NAME: cargo-fetcher | |
TARGET: ${{ matrix.target }} | |
run: .github/scripts/package.sh | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: "cargo-fetcher*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |