CI improvements + Android and FreeBSD targets (#177)
* Bump minimum Rust version to 1.60 As required by the `time` crate (`notify-rust` > `mac-notification-sys` > `time`). * Simplify CI Changes: - Bump `actions/checkout` to v3, fixing a bunch of warnings. - Replace unmaintained `actions-rs/cargo` by `dtolnay/rust-toolchain`. - Run Rustfmt only once. - Add support for cached dependencies (via `Swatinem/rust-cache`). * Add Android target Use the awesome `cross` tool for cross-compiling! * Add FreeBSD target
This commit is contained in:
committed by
Thomas Schönauer
parent
7442ddd386
commit
6be4a4a48d
120
.github/workflows/check-and-lint.yaml
vendored
120
.github/workflows/check-and-lint.yaml
vendored
@@ -4,67 +4,83 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
name: Check and Lint
|
env:
|
||||||
|
RUST_VER: '1.60.0'
|
||||||
|
CROSS_VER: '0.2.4'
|
||||||
|
CARGO_NET_RETRY: 3
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
|
||||||
name: Check
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [ ubuntu-latest, macos-latest, windows-latest ]
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
args: --color always
|
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
strategy:
|
runs-on: ubuntu-20.04
|
||||||
matrix:
|
|
||||||
platform: [ ubuntu-latest, macos-latest, windows-latest ]
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout code
|
||||||
- uses: actions-rs/toolchain@v1
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
- run: rustup component add rustfmt
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: fmt
|
|
||||||
args: --all -- --check --color always
|
|
||||||
|
|
||||||
clippy:
|
- name: Setup Rust
|
||||||
name: Clippy
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: '${{ env.RUST_VER }}'
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
components: clippy, rustfmt
|
||||||
|
|
||||||
|
- name: Run cargo fmt
|
||||||
|
run: |
|
||||||
|
cargo fmt --all -- --check
|
||||||
|
|
||||||
|
main:
|
||||||
|
needs: fmt
|
||||||
|
name: ${{ matrix.target_name }} (check, clippy)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ ubuntu-latest, macos-latest, windows-latest ]
|
include:
|
||||||
runs-on: ${{ matrix.platform }}
|
- target: x86_64-linux-android
|
||||||
|
target_name: Android
|
||||||
|
use_cross: true
|
||||||
|
os: ubuntu-20.04
|
||||||
|
|
||||||
|
- target: x86_64-unknown-freebsd
|
||||||
|
target_name: FreeBSD
|
||||||
|
use_cross: true
|
||||||
|
os: ubuntu-20.04
|
||||||
|
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
target_name: Linux
|
||||||
|
os: ubuntu-20.04
|
||||||
|
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
target_name: macOS
|
||||||
|
os: macos-11
|
||||||
|
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
target_name: Windows
|
||||||
|
os: windows-2019
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout code
|
||||||
- uses: actions-rs/toolchain@v1
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: '${{ env.RUST_VER }}'
|
||||||
components: clippy
|
targets: ${{ matrix.target }}
|
||||||
override: true
|
components: clippy, rustfmt
|
||||||
- uses: actions-rs/cargo@v1.0.1
|
|
||||||
|
- name: Setup Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
command: clippy
|
prefix-key: ${{ matrix.target }}
|
||||||
args: --color always --all-targets --locked -- -D warnings
|
|
||||||
name: Clippy Output
|
- name: Setup cross
|
||||||
- uses: actions-rs/cargo@v1.0.1
|
if: matrix.use_cross == true
|
||||||
with:
|
run: curl -fL --retry 3 https://github.com/cross-rs/cross/releases/download/v${{ env.CROSS_VER }}/cross-x86_64-unknown-linux-musl.tar.gz | tar vxz -C /usr/local/bin
|
||||||
command: clippy
|
|
||||||
args: --color always --all-targets --locked --all-features -- -D warnings
|
- name: Run cargo check
|
||||||
name: Clippy (All features) Output
|
run: ${{ matrix.use_cross == true && 'cross' || 'cargo' }} check --locked --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Run cargo clippy
|
||||||
|
run: ${{ matrix.use_cross == true && 'cross' || 'cargo' }} clippy --locked --target ${{ matrix.target }} --all-features -- -D warnings
|
||||||
|
|||||||
4
Cross.toml
Normal file
4
Cross.toml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Workaround for: https://github.com/cross-rs/cross/issues/1100
|
||||||
|
# TODO: Remove this file altogether once a new version of cross (after v0.2.4) is released.
|
||||||
|
[target.x86_64-unknown-freebsd.env]
|
||||||
|
passthrough = ["AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-ar"]
|
||||||
@@ -32,7 +32,7 @@ To remedy this, **Topgrade** detects which tools you use and runs the appropriat
|
|||||||
Other systems users can either use `cargo install` or the compiled binaries from the release page.
|
Other systems users can either use `cargo install` or the compiled binaries from the release page.
|
||||||
The compiled binaries contain a self-upgrading feature.
|
The compiled binaries contain a self-upgrading feature.
|
||||||
|
|
||||||
Topgrade requires Rust 1.51 or above.
|
Topgrade requires Rust 1.60 or above.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user