Skip to content

WIP

WIP #479

Workflow file for this run

name: Build
permissions:
contents: write
on:
push:
# only trigger on branches, not on tags
branches: '**'
tags:
- v[0-9]+.*
jobs:
build:
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
runs-on: ${{ matrix.os }}
env:
TARGET: ${{ matrix.TARGET }}
OS: ${{ matrix.OS }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
./target
key: build-cargo-registry-${{matrix.TARGET}}
- name: Install and configure dependencies
run: |
# dependencies are only needed on ubuntu as that's the only place where
# we make cross-compilation
if [[ $OS =~ ^ubuntu.*$ ]]; then
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf protobuf-compiler libprotobuf-dev
fi
# some additional configuration for cross-compilation on linux
cat >>~/.cargo/config <<EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
EOF
- name: E2E Tests
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
set -x
sudo apt-get install --reinstall resolvconf
sudo snap install multipass
ssh-keygen -b 2048 -t rsa -f ./sshkey -q -N ""
export SSH_PRIVATE_KEY=./sshkey
sleep 10
cat /var/log/syslog|grep multipass
SUDO_MULTIPASS=1 make run-integration-tests
- name: Install rust target
run: rustup target add $TARGET
# todo - move back to correct place
- name: Normal Tests
run: cargo test
- name: Build Binaries
run: cargo build --locked --release --target ${{ matrix.target }}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.TARGET}}
path: target/${{matrix.TARGET}}/release
create-release:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
release:
needs: [ build, create-release ]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
strategy:
matrix:
include:
- target: aarch64-apple-darwin
- target: aarch64-unknown-linux-gnu
- target: x86_64-unknown-linux-gnu
env:
TARGET: ${{ matrix.TARGET }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{matrix.TARGET}}
path: |
target/${{matrix.TARGET}}/release
- name: Archive and upload
run: |
mkdir -p dist
cd dist
cp ../target/$TARGET/release/skate .
cp ../target/$TARGET/release/skatelet .
chmod +x skate
chmod +x skatelet
tar -cvf skate-$TARGET.tar.gz skate
tar -cvf skatelet-$TARGET.tar.gz skatelet
gh release upload ${{github.ref_name}} *.tar.gz