Skip to content

Update vergen to v8 #295

Update vergen to v8

Update vergen to v8 #295

Workflow file for this run

name: CI # Continuous Integration
on:
push:
branches:
- master
pull_request:
jobs:
# New security advisories can pop up at any time, so they shouldn't fail a build, but they should
# fail the job to call attention to the fact that there's an advisory
check-rust-sec-advisories:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --all-features
command: check advisories
# Do all possible static checks here
cargo-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
# The latest version of nightly leads to failre on CI check:
# error[E0635]: unknown feature `proc_macro_span_shrink`
# --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.58/src/lib.rs:92:30
# |
# 92 | feature(proc_macro_span, proc_macro_span_shrink)
# | ^^^^^^^^^^^^^^^^^^^^^^
#
# to prevent this we pinned the specific version of nightly with doesn't have this bug, you can unpin the version
# if you check that this works
#
# More details see here: https://github.com/dtolnay/proc-macro2/issues/356#issuecomment-1614449061
# and here https://github.com/dtolnay/proc-macro2/issues/356#issuecomment-1614467505
#
toolchain: nightly-2023-06-15
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --all-features
command: check bans licenses sources
- name: Install cargo-udeps
shell: bash
run: |
wget \
--output-file cargo-udeps.tar.gz \
--tries=10 --retry-connrefused \
https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz
tar xvzf cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz --strip-components=2
mv cargo-udeps $HOME/.cargo/bin/
- name: Check for unused dependencies
shell: bash
run: |
cargo +nightly-2023-06-15 udeps
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
needs: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features --workspace -- -D warnings
test:
needs: clippy
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Cache the minio binary
id: cache-minio
uses: actions/cache@v3
with:
path: ~/.local/bin
key: ${{ runner.os }}-minio
- name: Install minio (Linux)
shell: bash
run: |
# Download the minio binary if it's not already present
# Most of the time the minio binary should be in the cache and doesn't need to be downloaded again
mkdir -p $HOME/.local/bin
cd $HOME/.local/bin
if [[ ! -x ./minio ]]
then
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
fi
echo "$HOME/.local/bin" >> $GITHUB_PATH
if: matrix.os == 'ubuntu-latest'
- name: Install minio (mac)
shell: bash
run: |
# Download the minio binary if it's not already present
# Most of the time the minio binary should be in the cache and doesn't need to be downloaded again
mkdir -p $HOME/.local/bin
cd $HOME/.local/bin
if [[ ! -x ./minio ]]
then
curl --progress-bar -O https://dl.min.io/server/minio/release/darwin-amd64/minio
chmod +x minio
fi
echo "$HOME/.local/bin" >> $GITHUB_PATH
if: matrix.os == 'macos-latest'
- name: Install minio (Windows)
run: |
# Download the minio binary if it's not already present
mkdir -p C:\minio
Invoke-WebRequest -Uri "https://dl.min.io/server/minio/release/windows-amd64/minio.exe" -OutFile "C:\minio\minio.exe"
echo "c:\minio" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: matrix.os == 'windows-latest'
- name: Run local tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --workspace
- name: Run S3 tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --workspace -- --ignored
# Even on PR builds, verify that static compilation works and that the resulting executable
# can run. It's easy to add crate dependencies which break static builds
build-static:
needs: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: x86_64-unknown-linux-musl
- name: Install MUSL deps
run: |
sudo apt-get install musl musl-dev musl-tools
- uses: Swatinem/rust-cache@v2
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl --package ssstar-cli
env:
RUSTFLAGS: '-C target-feature=+crt-static'
- name: Test static binary
run: |
target/x86_64-unknown-linux-musl/release/ssstar --version
docs:
needs: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --document-private-items --all-features --workspace --examples