Added dkms compilation to binary builds #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Binary build | |
on: | |
push: | |
branch: | |
- 'main' | |
- 'stable' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
cross-build: | |
name: Publish binary builds | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download renamer | |
run: curl -sSf https://raw.githubusercontent.com/memflow/memflowup/master/target_rename.sh > target_rename.sh | |
- name: Build artifacts | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --all-features --workspace --verbose --target ${{ matrix.target }} | |
- name: Rename and collect artifacts | |
id: artifacts | |
run: echo "::set-output name=artifact::$(sh ./target_rename.sh "${{ matrix.target }}" | head -n 1)" | |
- name: Upload build artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: bin-${{ github.ref_name }} | |
files: | | |
${{ steps.artifacts.outputs.artifact }} | |
kmod-build: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install dkms linux-headers-`uname -r` build-essential devscripts dh-make | |
- run: source dkms.conf && echo "BUILT_MODULE_NAME=$BUILT_MODULE_NAME" >> $GITHUB_ENV && echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
- run: echo "DKMS_DIR=/usr/src/${BUILT_MODULE_NAME}-${PACKAGE_VERSION}" >> $GITHUB_ENV | |
- run: sudo mkdir $DKMS_DIR | |
- run: sudo cp -r * $DKMS_DIR | |
- run: sudo dkms build -m $BUILT_MODULE_NAME -v $PACKAGE_VERSION | |
- run: sudo dkms mktarball -m $BUILT_MODULE_NAME -v $PACKAGE_VERSION --source-only | |
- run: sudo dkms mkdeb -m $BUILT_MODULE_NAME -v $PACKAGE_VERSION --source-only | |
- name: Find debian package | |
id: dkms_path | |
run: | | |
export F="$(sudo find /var/lib/dkms/${BUILT_MODULE_NAME}/${PACKAGE_VERSION}/deb/${BUILT_MODULE_NAME}-dkms_${PACKAGE_VERSION}*.deb)" | |
echo "::set-output name=path::$F" | |
echo "::set-output name=name::$(basename $F)" | |
- name: Find tarball | |
id: tarball_path | |
run: | | |
export F="$(sudo find /var/lib/dkms/${BUILT_MODULE_NAME}/${PACKAGE_VERSION}/tarball/${BUILT_MODULE_NAME}-${PACKAGE_VERSION}*.tar.gz)" | |
echo "::set-output name=path::$F" | |
echo "::set-output name=name::$(basename $F)" | |
- name: Upload deb artifact | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: bin-${{ github.ref_name }} | |
files: | | |
${{ steps.dkms_path.outputs.path }} | |
- name: Upload tarball | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: bin-${{ github.ref_name }} | |
files: | | |
${{ steps.tarball_path.outputs.path }} |