From dc83218f4fefad5995e693198d32b4a6324c5083 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Wed, 5 Jun 2024 15:02:34 -0400 Subject: [PATCH] Build debian packages (#11) --- .github/workflows/build.yml | 27 +++++++++++++++------------ eng/build.sh | 14 ++++++++------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1864b52..1ad23fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,33 +13,36 @@ jobs: fail-fast: false matrix: include: - - build: linux - os: ubuntu-latest - target: x86_64-unknown-linux-gnu + - build: ubuntu-22.04 + os: ubuntu-22.04 + - build: ubuntu-24.04 + os: ubuntu-24.04 - build: macos os: macos-latest - target: x86_64-apple-darwin - - build: win-msvc + - build: windows os: windows-latest - target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - with: - target: ${{ matrix.target }} - uses: Swatinem/rust-cache@v2 - - run: eng/build.sh ${{ matrix.target }} + - run: eng/build.sh shell: bash - uses: actions/upload-artifact@v4 if: matrix.os == 'windows-latest' with: name: ${{ matrix.build }} - path: target/${{ matrix.target }}/release/az-pim.exe + path: target/release/az-pim.exe + if-no-files-found: error + - uses: actions/upload-artifact@v4 + if: matrix.os == 'macos-latest' + with: + name: ${{ matrix.build }} + path: target/release/az-pim if-no-files-found: error - uses: actions/upload-artifact@v4 - if: matrix.os != 'windows-latest' + if: startsWith(matrix.os, 'ubuntu-') with: name: ${{ matrix.build }} - path: target/${{ matrix.target }}/release/az-pim + path: target/debian/*.deb if-no-files-found: error diff --git a/eng/build.sh b/eng/build.sh index 4066756..1208187 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -2,18 +2,16 @@ set -uvex -o pipefail -BUILD_TARGET=${1:-""} -BUILD_PROFILE=${2:-"release"} - cd $(dirname ${BASH_SOURCE[0]})/../ which typos || cargo install typos-cli -BUILD_COMMON="--locked --profile ${BUILD_PROFILE}" -if [ x"${BUILD_TARGET}" != x"" ]; then - BUILD_COMMON="${BUILD_COMMON} --target ${BUILD_TARGET}" +if [[ ${OSTYPE} == "linux-gnu"* ]]; then + which cargo-deb || cargo install cargo-deb fi +BUILD_COMMON="--locked --profile release" + typos cargo clippy ${BUILD_COMMON} --all-targets --all-features -- -D warnings -D clippy::pedantic -A clippy::missing_errors_doc -A clippy::module_name_repetitions cargo clippy ${BUILD_COMMON} --tests --all-targets --all-features -- -D warnings @@ -22,3 +20,7 @@ cargo build ${BUILD_COMMON} cargo test ${BUILD_COMMON} cargo run ${BUILD_COMMON} -- readme > README.md git diff --exit-code README.md + +if [[ ${OSTYPE} == "linux-gnu"* ]]; then + cargo deb +fi