FIX arm64 corss build issue #4
Workflow file for this run
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: Build and Publish | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build: | |
name: Build for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
artifact_name: core-to-core-latency | |
asset_name: core-to-core-latency-linux-amd64 | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
artifact_name: core-to-core-latency | |
asset_name: core-to-core-latency-linux-arm64 | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
artifact_name: core-to-core-latency.exe | |
asset_name: core-to-core-latency-windows-amd64.exe | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: core-to-core-latency | |
asset_name: core-to-core-latency-macos-amd64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: core-to-core-latency | |
asset_name: core-to-core-latency-macos-arm64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Set up for aarch64 cross-compilation | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo dpkg --add-architecture arm64 | |
sudo tee /etc/apt/sources.list.d/arm64.list > /dev/null <<EOT | |
deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted | |
deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted | |
deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs) universe | |
deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates universe | |
EOT | |
sudo apt-get update | |
sudo apt-get install -y crossbuild-essential-arm64 libssl-dev:arm64 | |
echo "OPENSSL_DIR=/usr/aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.asset_name }} | |
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | |
create-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
- name: Upload Release Assets | |
run: | | |
for asset in core-to-core-latency-*; do | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: $(file -b --mime-type $asset)" \ | |
--data-binary @$asset \ | |
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $asset)" | |
done | |
publish-crates: | |
needs: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Publish to crates.io | |
uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
args: --token ${{ secrets.CRATES_IO_TOKEN }} | |
actions-timeline: | |
needs: [build, create-release, publish-crates] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Kesin11/actions-timeline@v2 |