build(deps): bump actions/checkout from 3 to 4 #2053
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: [push] | |
env: | |
CARGO_TERM_COLOR: always | |
STATIC_BUILD_TARGET: x86_64-unknown-linux-musl | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
RUST_BACKTRACE: '1' | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check | |
- run: cargo check --benches | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo build --verbose | |
- run: cargo clippy --tests -- -D warnings | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@nextest | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: execute build scripts | |
run: | | |
touch actix-consumer/build.rs | |
touch stub-consumer/build.rs | |
cargo build | |
- name: Enable Docker Remote API on Localhost | |
shell: bash | |
run: | | |
sudo mkdir -p /etc/systemd/system/docker.service.d/ | |
sudo cp ./.github/docker.override.conf /etc/systemd/system/docker.service.d/override.conf | |
sudo systemctl daemon-reload | |
sudo systemctl restart docker | |
# - run: cargo nextest run --verbose --all-features | |
- run: cargo test --all-features | |
- run: cargo test --doc | |
hack: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@cargo-hack | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: cargo/hack (verify features compile in isolation) | |
run: cargo hack check --each-feature --no-dev-deps | |
release: | |
# runs on tags only | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ check ] | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
file: stubr | |
from-file: ./target/release/stubr | |
to-file: stubr-linux.tar.gz | |
args: --best --lzma | |
strip: true | |
- os: macos-11 | |
file: stubr | |
from-file: ./target/release/stubr | |
to-file: stubr-macos.tar.gz | |
args: --best | |
strip: true | |
- os: windows-latest | |
file: stubr.exe | |
from-file: ./target/release/stubr.exe | |
to-file: stubr-windows.zip | |
args: -9 | |
strip: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- run: cargo build --release | |
- name: upx | |
uses: svenstaro/upx-action@2.3.0 | |
with: | |
file: ${{ matrix.from-file }} | |
args: ${{ matrix.args }} | |
strip: ${{ matrix.strip }} | |
continue-on-error: true | |
- name: compression/tar | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-11' }} | |
run: | | |
cd target/release | |
tar czf ${{ matrix.to-file }} ${{ matrix.file }} | |
mv ${{ matrix.to-file }} ../.. | |
- name: compression/zip | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cd target/release | |
7z a ${{ matrix.to-file }} ${{ matrix.file }} | |
mv ${{ matrix.to-file }} ../.. | |
- name: bench | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
mkdir -p target/criterion | |
cd target/criterion | |
curl -OL https://github.com/beltram/stubr/releases/download/0.3.1/bench.tar.gz | |
tar -xzf bench.tar.gz | |
rm bench.tar.gz | |
cargo bench | |
tar czf ../bench.tar.gz . | |
- name: release-assets | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
${{ matrix.to-file }} | |
target/bench.tar.gz | |
publish: | |
# runs on tags only | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: publish plugin | |
run: | | |
cd build | |
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
- name: publish attributes | |
run: | | |
cd attributes | |
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
- name: publish lib | |
run: | | |
cd lib | |
sleep 180 | |
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
- name: publish cli | |
run: | | |
cd cli | |
sleep 180 | |
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} | |
docker_publish: | |
# runs on tags only | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
env: | |
DOCKER_BUILD: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: build-musl | |
uses: gmiam/rust-musl-action@master | |
with: | |
args: cargo build --target ${STATIC_BUILD_TARGET} --release --manifest-path="cli/Cargo.toml" --features=cloud | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/beltram/stubr:${{github.ref_name}}, ghcr.io/beltram/stubr:latest |