Skip to content

Commit

Permalink
chore: ⚡️ Split Raspberry CI into a file
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Oct 4, 2022
1 parent 8580fa0 commit d6d292f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 48 deletions.
45 changes: 1 addition & 44 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ on:
required: false
default: ""
type: string
arch:
required: false
default: ""
type: string

env:
CARGO_TERM_COLOR: always
Expand All @@ -40,57 +36,18 @@ jobs:

- uses: Swatinem/rust-cache@v1

- name: Replace target string
if: inputs.arch != ''
uses: mad9000/actions-find-and-replace-string@1
id: findandreplace
with:
source: ${{ inputs.target }}
find: "unknown-"
replace: ""

- name: Build dependencies raspberry targets
if: inputs.runs_on == 'ubuntu-latest' && inputs.arch != ''
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
echo "deb [arch=${{ inputs.arch }}] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{ inputs.arch }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo dpkg --add-architecture ${{ inputs.arch }}
sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:${{ inputs.arch }}" "libgcc-s1:${{ inputs.arch }}" "libc6:${{ inputs.arch }}" "libudev-dev:${{ inputs.arch }}" gcc-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu
echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV
echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV
echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
if [[ ${{ inputs.arch }} == arm64 ]]; then
echo "PKG_CONFIG_PATH=/usr/lib/${{ steps.findandreplace.outputs.value }}/pkgconfig" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${{ steps.findandreplace.outputs.value }}-gcc" >> $GITHUB_ENV
fi
if [[ ${{ inputs.arch }} == armhf ]]; then
echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
fi
- name: Build dependencies for other ubuntu targets
if: inputs.runs_on == 'ubuntu-latest' && inputs.arch == ''
if: inputs.runs_on == 'ubuntu-latest'
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install musl-tools libudev-dev
- uses: actions-rs/cargo@v1
if: ${{ inputs.arch == '' }}
with:
command: build
args: --release --all --target ${{ inputs.target }}

- uses: actions-rs/cargo@v1
if: ${{ inputs.arch != '' }}
with:
command: build
args: --release --all --target ${{ inputs.target }} --features=raspberry

- name: Compress (Unix)
if: ${{ inputs.runs_on != 'windows-latest' }}
run: zip -j ${{ matrix.crate }}-${{ inputs.target }}.zip target/${{ inputs.target }}/release/${{ matrix.crate }}${{ inputs.extension }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ jobs:
# Linux

armv7-unknown-linux-gnueabihf:
uses: ./.github/workflows/package.yml
uses: ./.github/workflows/raspberry.yml
with:
runs_on: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
arch: armhf

aarch64-unknown-linux-gnu:
uses: ./.github/workflows/package.yml
uses: ./.github/workflows/raspberry.yml
with:
runs_on: ubuntu-latest
target: aarch64-unknown-linux-gnu
arch: arm64

Expand Down

0 comments on commit d6d292f

Please sign in to comment.