Skip to content

Update rust.yml

Update rust.yml #12

Workflow file for this run

name: Rust
on:
workflow_dispatch:
pull_request:
push:
tags:
- 'v*'
branches:
- main
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
COMPLETION_DIR: "target/tmp/bottom/completion/"
MANPAGE_DIR: "target/tmp/bottom/manpage/"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'ClementTsang/bottom' }}
jobs:
release:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Check if this action should be skipped
id: skip_check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
with:
skip_after_successful_duplicate: "true"
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]'
do_not_skip: '["workflow_dispatch", "push"]'
build-release:
needs: release
runs-on: ${{ matrix.info.os }}
if: ${{ needs.release.outputs.should_skip != 'true' }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
info:
- {
os: "ubuntu-latest",
target: "i686-unknown-linux-gnu",
cross: true,
rust: stable,
}
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: true,
rust: stable,
}
- {
os: "windows-2019",
target: "i686-pc-windows-msvc",
cross: false,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-gnu",
cross: false,
rust: stable,
}
# Beta
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
rust: beta,
}
- {
os: "macos-12",
target: "x86_64-apple-darwin",
cross: false,
rust: beta,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
rust: beta,
}
steps:
- name: Install Dependencies
if: ${{ matrix.info.os == 'ubuntu-latest' }}
run: sudo apt update && sudo apt install pkg-config libssl-dev -y
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: ${{ matrix.info.rust }}
target: ${{ matrix.info.target }}
- name: Enable Rust cache
uses: Swatinem/rust-cache@378c8285a4eaf12899d11bea686a763e906956af # 2.7.3
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
with:
key: ${{ matrix.info.target }}
cache-all-crates: true
- name: Try building with only default features enabled
uses: ClementTsang/[email protected]
if: ${{ matrix.info.no-default-features != true }}
with:
command: build
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
- name: Try building with no features enabled
uses: ClementTsang/[email protected]
if: ${{ matrix.info.no-default-features == true }}
with:
command: build
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked --no-default-features
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
upload-assets:
needs: build-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: ...
# (optional) Archive name (non-extension portion of filename) to be uploaded.
# [default value: $bin-$target]
# [possible values: the following variables and any string]
# variables:
# - $bin - Binary name (non-extension portion of filename).
# - $target - Target triple.
# - $tag - Tag of this release.
# When multiple binary names are specified, default archive name or $bin variable cannot be used.
archive: $bin-$tag-$target
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
completion:
name: "Check"
needs: [build-release]
if: ${{ success() || failure() }}
runs-on: "ubuntu-latest"
steps:
- name: Relesead Success
if: ${{ (needs.build-release.result == 'success') || (needs.build-release.result == 'skipped') }}
run: |
echo "Release completed successfully.";
- name: Release Failed
if: ${{ needs.build-release.result == 'failure' }}
run: |
echo "Release failed!";
exit 1;