Update CI/CD
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by David Peter · parent 94322c5 · Browse files · 1 file·+43 added−43 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+43 added−43 removed
- other:+43 added−43 removed
Provenance
- Commit
13357a9- Tree
51db511- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
94322c5
1 file changed+43 added−43 removed
modified:.github/workflows/CICD.yml+43 added-43 removed
12 unmodified lines13 tags:14 - '*'15 16 jobs:17+ ensure_cargo_fmt:18+ name: Ensure 'cargo fmt' has been run19+ runs-on: ubuntu-20.0420+ steps:21+ - uses: dtolnay/rust-toolchain@stable22+ with:23+ components: rustfmt24+ - uses: actions/checkout@v325+ - run: cargo fmt -- --check26+ - name: Ensure MSRV is set in `clippy.toml`27+ run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml28+29 min_version:30 name: Minimum supported rust version31 runs-on: ubuntu-20.0432 steps:33 - name: Checkout source code34 uses: actions/checkout@v323-35 - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})25- uses: actions-rs/toolchain@v136+ uses: dtolnay/rust-toolchain@master37 with:38 toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}28- default: true29- profile: minimal # minimal component installation (ie, no documentation)30- components: clippy, rustfmt39+ components: clippy31- - name: Ensure `cargo fmt` has been run32- uses: actions-rs/cargo@v133- with:34- command: fmt35- args: -- --check40 - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)37- uses: actions-rs/cargo@v138- with:39- command: clippy40- args: --locked --all-targets --all-features -- --allow unknown_lints41+ run: cargo clippy --locked --all-targets ${{ env.MSRV_FEATURES }}42 - name: Run tests42- uses: actions-rs/cargo@v143- with:44- command: test45- args: --locked43+ run: cargo test --locked ${{ env.MSRV_FEATURES }}44 45 build:48- name: ${{ matrix.job.target }} (${{ matrix.job.os }})46+ name: ${{ matrix.job.os }} (${{ matrix.job.target }})47 runs-on: ${{ matrix.job.os }}48 strategy:49 fail-fast: false50 matrix:3 unmodified lines54 - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }55 - { target: i686-pc-windows-msvc , os: windows-2019 }56 - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }57 - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }60- - { target: x86_64-apple-darwin , os: macos-10.15 }58+ - { target: x86_64-apple-darwin , os: macos-12 }59 - { target: x86_64-pc-windows-gnu , os: windows-2019 }60 - { target: x86_64-pc-windows-msvc , os: windows-2019 }61 - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }62 - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }17 unmodified lines80 echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV81 echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV82 83 - name: Install Rust toolchain86- uses: actions-rs/toolchain@v184+ uses: dtolnay/rust-toolchain@stable85 with:88- toolchain: stable89- target: ${{ matrix.job.target }}86+ targets: ${{ matrix.job.target }}90- override: true91- profile: minimal # minimal component installation (ie, no documentation)87 88+ - name: Install cross89+ if: matrix.job.use-cross90+ uses: taiki-e/install-action@v291+ with:92+ tool: cross93+94+ - name: Overwrite build command env variable95+ if: matrix.job.use-cross96+ shell: bash97+ run: echo "BUILD_CMD=cross" >> $GITHUB_ENV98+99 - name: Show version information (Rust, cargo, GCC)100 shell: bash101 run: |102 gcc --version || true3 unmodified lines106 cargo -V107 rustc -V108 109 - name: Build104- uses: actions-rs/cargo@v1105- with:106- use-cross: ${{ matrix.job.use-cross }}107- command: build108- args: --locked --release --target=${{ matrix.job.target }}110+ shell: bash111+ run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }}112 113 - name: Strip debug information from executable114 id: strip115 shell: bash26 unmodified lines142 "${STRIP}" "${BIN_PATH}"143 fi144 145 # Let subsequent steps know where to find the (stripped) bin143- echo ::set-output name=BIN_PATH::${BIN_PATH}144- echo ::set-output name=BIN_NAME::${BIN_NAME}146+ echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT147+ echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT148 149 - name: Set testing options150 id: test-options151 shell: bash152 run: |153 # test only library unit tests and binary for arm-type targets154 unset CARGO_TEST_OPTIONS155 unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--bin ${PROJECT_NAME}" ;; esac;153- echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}156+ echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT157 158 - name: Run tests156- uses: actions-rs/cargo@v1157- with:158- use-cross: ${{ matrix.job.use-cross }}159- command: test160- args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}159+ shell: bash160+ run: $BUILD_CMD test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}161 162 - name: Create tarball163 id: package164 shell: bash165 run: |166 PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;167 PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }}168 PKG_NAME=${PKG_BASENAME}${PKG_suffix}169- echo ::set-output name=PKG_NAME::${PKG_NAME}169+ echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT170 171 PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"172 ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"173 mkdir -p "${ARCHIVE_DIR}"22 unmodified lines196 esac;197 popd >/dev/null198 199 # Let subsequent steps know where to find the compressed package200- echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"200+ echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT201 202 - name: Create Debian package203 id: debian-package204 shell: bash18 unmodified lines223 *) DPKG_ARCH=notset ;;224 esac;225 226 DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"227- echo ::set-output name=DPKG_NAME::${DPKG_NAME}227+ echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT228 229 # Binary230 install -Dm755 "${{ steps.strip.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.strip.outputs.BIN_NAME }}"231 69 unmodified lines301 Description: A command-line benchmarking tool302 EOF303 304 DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"305- echo ::set-output name=DPKG_PATH::${DPKG_PATH}305+ echo "DPKG_PATH=${DPKG_PATH}" >> $GITHUB_OUTPUT306 307 # build dpkg308 fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"309 14 unmodified lines324 id: is-release325 shell: bash326 run: |327 unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi328- echo ::set-output name=IS_RELEASE::${IS_RELEASE}328+ echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT329 330 - name: Publish archives and packages331 uses: softprops/action-gh-release@v1332 if: steps.is-release.outputs.IS_RELEASE6 unmodified lines