Skip to content

Cross Compilation

Cross Compilation #31

Workflow file for this run

name: Cross Compilation
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- riscv64gc-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: Pull Docker image from Docker Hub
run: docker pull 255doesnotexist/lintestor-cross-compile:latest
- name: Cross compile
run: |
docker run --rm -v ${{ github.workspace }}:/root/src 255doesnotexist/lintestor-cross-compile:latest \
sh -c "cd /root/src && cargo build --release --target ${{ matrix.target }} && mv target/${{ matrix.target }}/release/lintestor target/${{ matrix.target }}/release/lintestor-${{ matrix.target }}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lintestor-${{ matrix.target }}
path: target/${{ matrix.target }}/release/lintestor-${{ matrix.target }}
create-release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ steps.date.outputs.date }}
release_name: Nightly Release ${{ steps.date.outputs.date }}
draft: false
prerelease: false
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload Release Assets
run: |
for artifact in artifacts/lintestor-*/*; do
asset_name=$(basename "$artifact")
echo "Uploading $asset_name"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=${asset_name}" \
--data-binary "@$artifact"
done