CICD.yml
This file
Path
.github/workflows/CICD.yml
363 lines · 15.0 KiB · YAML
Last changed by
Prepare release v2.0.0-alpha.1David Peterbefore adoptionccc8449
History of this fileTake it
The walk stopped after 200 commits: lines older than ac3b351 point at it.
Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 1–20why, one step back1name: CICD23env:4 CICD_INTERMEDIATES_DIR: "_cicd-intermediates"5 MSRV_FEATURES: ""67on:8 workflow_dispatch:9 pull_request:10 push:11 branches:12 - master13 tags:14 - '*'1516jobs:17 crate_metadata:18 name: Extract crate metadata19 runs-on: ubuntu-latest20 steps:Merge pull request #974 from sharkdp/dependabot/github_actions/actions/checkout-7David Peterbefore adoptionee96552
line 21why, one step back21 - uses: actions/checkout@v7Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 22–24why, one step back22 - name: Extract crate information23 id: crate_metadata24 run: |Update CICD.ymlrindealbefore adoption83edd2f
lines 25–36why, one step back25 cargo metadata --no-deps --format-version 1 | jq -r '26 .packages[0] |27 [28 "name=" + .name,29 "version=" + .version,30 "maintainer=" + (.authors[0] // ""),31 "homepage=" + (.homepage // ""),32 "msrv=" + (.rust_version // ""),33 "bin-name=" + ( (.targets[] | select(.kind[0] == "bin") | .name) // .name )34 ] |35 join("\n")36 ' | tee -a $GITHUB_OUTPUTBump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 37–42why, one step back37 outputs:38 name: ${{ steps.crate_metadata.outputs.name }}39 version: ${{ steps.crate_metadata.outputs.version }}40 maintainer: ${{ steps.crate_metadata.outputs.maintainer }}41 homepage: ${{ steps.crate_metadata.outputs.homepage }}42 msrv: ${{ steps.crate_metadata.outputs.msrv }}Update CICD.ymlrindealbefore adoption83edd2f
line 43why, one step back43 bin-name: ${{ steps.crate_metadata.outputs.bin-name }}Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 44–46why, one step back4445 ensure_cargo_fmt:46 name: Ensure 'cargo fmt' has been runFix CIDavid Peterbefore adoptionf8db978
line 47why, one step back47 runs-on: ubuntu-24.04Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 48–51why, one step back48 steps:49 - uses: dtolnay/rust-toolchain@stable50 with:51 components: rustfmtMerge pull request #974 from sharkdp/dependabot/github_actions/actions/checkout-7David Peterbefore adoptionee96552
line 52why, one step back52 - uses: actions/checkout@v7Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 53–56why, one step back53 - run: cargo fmt -- --check5455 min_version:56 name: Minimum supported rust versionFix CIDavid Peterbefore adoptionf8db978
line 57why, one step back57 runs-on: ubuntu-24.04Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 58–60why, one step back58 needs: crate_metadata59 steps:60 - name: Checkout source codeMerge pull request #974 from sharkdp/dependabot/github_actions/actions/checkout-7David Peterbefore adoptionee96552
line 61why, one step back61 uses: actions/checkout@v7Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 62–80why, one step back6263 - name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }})64 uses: dtolnay/rust-toolchain@master65 with:66 toolchain: ${{ needs.crate_metadata.outputs.msrv }}67 components: clippy68 - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)69 run: cargo clippy --locked --all-targets ${{ env.MSRV_FEATURES }}70 - name: Run tests71 run: cargo test --locked ${{ env.MSRV_FEATURES }}7273 build:74 name: ${{ matrix.job.target }} (${{ matrix.job.os }})75 runs-on: ${{ matrix.job.os }}76 needs: crate_metadata77 strategy:78 fail-fast: false79 matrix:80 job:Fix CIDavid Peterbefore adoptionf8db978
line 81why, one step back81 - { target: aarch64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }ci: add Linux ARM64 musl release target (#924)Marshall Porterbefore adoption1f5a2ff
line 82why, one step back82 - { target: aarch64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }Fix CIDavid Peterbefore adoptionf8db978
lines 83–91why, one step back83 - { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }84 - { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }85 - { target: i686-pc-windows-msvc , os: windows-2022 }86 - { target: i686-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }87 - { target: i686-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }88 - { target: x86_64-apple-darwin , os: macos-15 }89 - { target: aarch64-apple-darwin , os: macos-15 }90 # - { target: x86_64-pc-windows-gnu , os: windows-2022 }91 - { target: x86_64-pc-windows-msvc , os: windows-2022 }ci: add native Windows ARM64 releases (#922)Marshall Porterbefore adoption0f7ae35
line 92why, one step back92 - { target: aarch64-pc-windows-msvc , os: windows-11-arm }Fix CIDavid Peterbefore adoptionf8db978
lines 93–94why, one step back93 - { target: x86_64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }94 - { target: x86_64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 95–98why, one step back95 env:96 BUILD_CMD: cargo97 steps:98 - name: Checkout source codeMerge pull request #974 from sharkdp/dependabot/github_actions/actions/checkout-7David Peterbefore adoptionee96552
line 99why, one step back99 uses: actions/checkout@v7Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 100–127why, one step back100101 - name: Install prerequisites102 shell: bash103 run: |104 case ${{ matrix.job.target }} in105 arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;106 aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;107 esac108109 - name: Install Rust toolchain110 uses: dtolnay/rust-toolchain@stable111 with:112 targets: ${{ matrix.job.target }}113114 - name: Install cross115 if: matrix.job.use-cross116 uses: taiki-e/install-action@v2117 with:118 tool: cross119120 - name: Overwrite build command env variable121 if: matrix.job.use-cross122 shell: bash123 run: echo "BUILD_CMD=cross" >> $GITHUB_ENV124125 - name: Show version information (Rust, cargo, GCC)126 shell: bash127 run: |Update CICD.ymlrindealbefore adoption83edd2f
line 128why, one step back128 set -xBump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 129–150why, one step back129 gcc --version || true130 rustup -V131 rustup toolchain list132 rustup default133 cargo -V134 rustc -V135136 - name: Build137 shell: bash138 run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }}139140 - name: Set binary name & path141 id: bin142 shell: bash143 run: |144 # Figure out suffix of binary145 EXE_suffix=""146 case ${{ matrix.job.target }} in147 *-pc-windows-*) EXE_suffix=".exe" ;;148 esac;149150 # Setup pathsUpdate CICD.ymlrindealbefore adoption83edd2f
line 151why, one step back151 BIN_NAME="${{ needs.crate_metadata.outputs.bin-name }}${EXE_suffix}"Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 152–163why, one step back152 BIN_PATH="target/${{ matrix.job.target }}/release/${BIN_NAME}"153154 # Let subsequent steps know where to find the binary155 echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT156 echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT157158 - name: Set testing options159 id: test-options160 shell: bash161 run: |162 # test only library unit tests and binary for arm-type targets163 unset CARGO_TEST_OPTIONSci: add native Windows ARM64 releases (#922)Marshall Porterbefore adoption0f7ae35
line 164why, one step back164 unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--bin ${{ needs.crate_metadata.outputs.bin-name }}" ;; esac;Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 165–222why, one step back165 echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT166167 - name: Run tests168 shell: bash169 run: $BUILD_CMD test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}170171 - name: Create tarball172 id: package173 shell: bash174 run: |175 PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;176 PKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-v${{ needs.crate_metadata.outputs.version }}-${{ matrix.job.target }}177 PKG_NAME=${PKG_BASENAME}${PKG_suffix}178 echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT179180 PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"181 ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"182 mkdir -p "${ARCHIVE_DIR}"183 mkdir -p "${ARCHIVE_DIR}/autocomplete"184185 # Binary186 cp "${{ steps.bin.outputs.BIN_PATH }}" "$ARCHIVE_DIR"187188 # README, LICENSE and CHANGELOG files189 cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"190191 # Man page192 cp 'doc/${{ needs.crate_metadata.outputs.name }}.1' "$ARCHIVE_DIR"193194 # Autocompletion files195 cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.bash' "$ARCHIVE_DIR/autocomplete/"196 cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.fish' "$ARCHIVE_DIR/autocomplete/"197 cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'_${{ needs.crate_metadata.outputs.name }}.ps1' "$ARCHIVE_DIR/autocomplete/"198 cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'_${{ needs.crate_metadata.outputs.name }}' "$ARCHIVE_DIR/autocomplete/"199200 # base compressed package201 pushd "${PKG_STAGING}/" >/dev/null202 case ${{ matrix.job.target }} in203 *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;;204 *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;;205 esac;206 popd >/dev/null207208 # Let subsequent steps know where to find the compressed package209 echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT210211 - name: Create Debian package212 id: debian-package213 shell: bash214 if: startsWith(matrix.job.os, 'ubuntu')215 run: |216 COPYRIGHT_YEARS="2018 - "$(date "+%Y")217 DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package"218 DPKG_DIR="${DPKG_STAGING}/dpkg"219 mkdir -p "${DPKG_DIR}"220221 DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}222 DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }}-muslFix CI errorDavid Peterbefore adoptionad7fa02
line 223why, one step back223 case ${{ matrix.job.target }} in *-musl*) DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-musl ; DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }} ;; esac;Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
line 224why, one step back224 DPKG_VERSION=${{ needs.crate_metadata.outputs.version }}Prepare release v2.0.0-alpha.1David Peterbefore adoptionccc8449
lines 225–226why, one step back225 # Debian prereleases must sort before the corresponding stable version.226 DPKG_VERSION=${DPKG_VERSION/-/\~}Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 227–341why, one step back227228 unset DPKG_ARCH229 case ${{ matrix.job.target }} in230 aarch64-*-linux-*) DPKG_ARCH=arm64 ;;231 arm-*-linux-*hf) DPKG_ARCH=armhf ;;232 i686-*-linux-*) DPKG_ARCH=i686 ;;233 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;234 *) DPKG_ARCH=notset ;;235 esac;236237 DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"238 echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT239240 # Binary241 install -Dm755 "${{ steps.bin.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.bin.outputs.BIN_NAME }}"242243 # Man page244 install -Dm644 'doc/${{ needs.crate_metadata.outputs.name }}.1' "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1"245 gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1"246247 # Autocompletion files248 install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/${{ needs.crate_metadata.outputs.name }}"249 install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ needs.crate_metadata.outputs.name }}.fish"250 install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'_${{ needs.crate_metadata.outputs.name }}' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ needs.crate_metadata.outputs.name }}"251252 # README and LICENSE253 install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"254 install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"255 install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"256 install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"257 gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"258259 cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF260 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/261 Upstream-Name: ${{ needs.crate_metadata.outputs.name }}262 Source: ${{ needs.crate_metadata.outputs.homepage }}263264 Files: *265 Copyright: ${{ needs.crate_metadata.outputs.maintainer }}266 Copyright: $COPYRIGHT_YEARS ${{ needs.crate_metadata.outputs.maintainer }}267 License: Apache-2.0 or MIT268269 License: Apache-2.0270 On Debian systems, the complete text of the Apache-2.0 can be found in the271 file /usr/share/common-licenses/Apache-2.0.272273 License: MIT274 Permission is hereby granted, free of charge, to any275 person obtaining a copy of this software and associated276 documentation files (the "Software"), to deal in the277 Software without restriction, including without278 limitation the rights to use, copy, modify, merge,279 publish, distribute, sublicense, and/or sell copies of280 the Software, and to permit persons to whom the Software281 is furnished to do so, subject to the following282 conditions:283 .284 The above copyright notice and this permission notice285 shall be included in all copies or substantial portions286 of the Software.287 .288 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF289 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED290 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A291 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT292 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY293 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION294 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR295 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER296 DEALINGS IN THE SOFTWARE.297 EOF298 chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"299300 # control file301 mkdir -p "${DPKG_DIR}/DEBIAN"302 cat > "${DPKG_DIR}/DEBIAN/control" <<EOF303 Package: ${DPKG_BASENAME}304 Version: ${DPKG_VERSION}305 Section: utils306 Priority: optional307 Maintainer: ${{ needs.crate_metadata.outputs.maintainer }}308 Homepage: ${{ needs.crate_metadata.outputs.homepage }}309 Architecture: ${DPKG_ARCH}310 Provides: ${{ needs.crate_metadata.outputs.name }}311 Conflicts: ${DPKG_CONFLICTS}312 Description: A command-line benchmarking tool313 EOF314315 DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"316 echo "DPKG_PATH=${DPKG_PATH}" >> $GITHUB_OUTPUT317318 # build dpkg319 fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"320321 - name: "Artifact upload: tarball"322 uses: actions/upload-artifact@master323 with:324 name: ${{ steps.package.outputs.PKG_NAME }}325 path: ${{ steps.package.outputs.PKG_PATH }}326327 - name: "Artifact upload: Debian package"328 uses: actions/upload-artifact@master329 if: steps.debian-package.outputs.DPKG_NAME330 with:331 name: ${{ steps.debian-package.outputs.DPKG_NAME }}332 path: ${{ steps.debian-package.outputs.DPKG_PATH }}333334 - name: Check for release335 id: is-release336 shell: bash337 run: |338 unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi339 echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT340341 - name: Publish archives and packagesMerge pull request #973 from sharkdp/dependabot/github_actions/softprops/action-gh-release-3David Peterbefore adoption580b500
line 342why, one step back342 uses: softprops/action-gh-release@v3Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 343–344why, one step back343 if: steps.is-release.outputs.IS_RELEASE344 with:Prepare release v2.0.0-alpha.1David Peterbefore adoptionccc8449
lines 345–346why, one step back345 prerelease: ${{ contains(needs.crate_metadata.outputs.version, '-') }}346 make_latest: ${{ contains(needs.crate_metadata.outputs.version, '-') && 'false' || 'true' }}Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 347–354why, one step back347 files: |348 ${{ steps.package.outputs.PKG_PATH }}349 ${{ steps.debian-package.outputs.DPKG_PATH }}350 env:351 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}352353 winget:354 name: Publish to WingetChange Winget Releaser job to `ubuntu-latest`sitiombefore adoption788c689
line 355why, one step back355 runs-on: ubuntu-latestBump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
line 356why, one step back356 needs: buildPrepare release v2.0.0-alpha.1David Peterbefore adoptionccc8449
line 357why, one step back357 if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')Bump libc from 0.2.142 to 0.2.144dependabot[bot]before adoptionac3b351
lines 358–363why, one step back358 steps:359 - uses: vedantmgoyal2009/winget-releaser@v2360 with:361 identifier: sharkdp.hyperfine362 installers-regex: '-pc-windows-msvc\.zip$'363 token: ${{ secrets.WINGET_TOKEN }}