Skip to content

Commit

Permalink
dpkg to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Oct 29, 2023
1 parent 3986cbe commit 1522c93
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 71 deletions.
55 changes: 34 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,10 @@ jobs:
fail-fast: false
matrix:
job:
# - { os: ubuntu-latest, target: arm-unknown-linux-gnueabihf, use-cross: true }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, use-cross: true }
# - { os: ubuntu-latest, target: i686-unknown-linux-gnu, use-cross: true }
# - { os: ubuntu-latest, target: i686-pc-windows-gnu, use-cross: true }
- { os: ubuntu-latest, target: x86_64-pc-windows-gnu, use-cross: true }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, use-cross: false }
- { os: macos-latest, target: universal-apple-darwin, use-cross: false }
# Targets are built as part of universal
# - { os: macos-latest, target: x86_64-apple-darwin, use-cross: false }
# - { os: macos-latest, target: aarch64-apple-darwin, use-cross: false }
# Windows host targets don't build
# - { os: windows-latest, target: i686-pc-windows-gnu, use-cross: false }
# - { os: windows-latest, target: x86_64-pc-windows-gnu, use-cross: false }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -76,17 +67,6 @@ jobs:
# don't run tests on Windows because libusb needs install TODO
if: matrix.job.use-cross == false && !startsWith(matrix.job.os, 'windows')
run: cargo test
# run: |
# case ${{ matrix.job.target }} in
# # apple only test on platform arch
# *-apple-*)
# cargo test
# ;;
# # else test on target arch
# *)
# ${{ env.CARGO_CMD }} test --target=${{ matrix.job.target }}
# ;;
# esac

- name: Build release
id: build
Expand Down Expand Up @@ -172,12 +152,43 @@ jobs:
# Let subsequent steps know where to find the compressed package
echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> "$GITHUB_OUTPUT"
- name: Create Debian package
id: debian-package
shell: bash
if: startsWith(matrix.job.os, 'ubuntu')
run: |
DPKG_STAGING="${{ env.INTERMEDIATES_DIR }}/debian-package"
DPKG_DIR="${DPKG_STAGING}/dpkg"
case ${{ matrix.job.target }} in
aarch64-*-linux-*) DPKG_ARCH=arm64 ;;
arm-*-linux-*hf) DPKG_ARCH=armhf ;;
i686-*-linux-*) DPKG_ARCH=i686 ;;
x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
*) DPKG_ARCH=notset ;;
esac;
DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"
echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT
mkdir -p "${DPKG_DIR}"
DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"
echo "DPKG_PATH=${DPKG_PATH}" >> $GITHUB_OUTPUT
cargo install cargo-deb
cargo deb --target=${{ matrix.job.target }} --output "${DPKG_PATH}"
- name: Upload package artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.package.outputs.PKG_NAME }}
path: ${{ steps.package.outputs.PKG_PATH }}

- name: Upload dpkg artifact
uses: actions/upload-artifact@master
if: steps.debian-package.outputs.DPKG_NAME
with:
name: ${{ steps.debian-package.outputs.DPKG_NAME }}
path: ${{ steps.debian-package.outputs.DPKG_PATH }}

- name: Check for release
id: is-release
shell: bash
Expand All @@ -189,7 +200,9 @@ jobs:
uses: softprops/action-gh-release@v1
if: steps.is-release.outputs.IS_RELEASE
with:
files: ${{ steps.package.outputs.PKG_PATH }}
files: |
${{ steps.package.outputs.PKG_PATH }}
${{ steps.debian-package.outputs.DPKG_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/manual_homebrew_tap_update.yaml

This file was deleted.

42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ pre-build = ["dpkg --add-architecture i386 && apt-get update && apt-get install

[package.metadata.cross.target.x86_64-unknown-linux-gnu]
pre-build = ["apt-get update && apt-get install --assume-yes libusb-1.0-0-dev libudev-dev"]

[package.metadata.deb]
section = "utility"

0 comments on commit 1522c93

Please sign in to comment.