Skip to content

Bump actions/checkout from 2 to 4 #13

Bump actions/checkout from 2 to 4

Bump actions/checkout from 2 to 4 #13

Workflow file for this run

name: CI
on:
push:
branches:
- master
release:
types: [released]
pull_request:
branches:
- master
jobs:
build:
name: Build and Release
permissions:
contents: write
env:
APP_NAME: hello_world
strategy:
matrix:
target:
# Windows
- { displayName: 32-bit Windows,
rustTarget: i686-pc-windows-gnu,
runner: 'ubuntu-latest' }
- { displayName: 64-bit Windows,
rustTarget: x86_64-pc-windows-gnu,
runner: 'ubuntu-latest' }
# Linux
- { displayName: 32-bit Linux,
rustTarget: i686-unknown-linux-gnu,
runner: 'ubuntu-latest' }
- { displayName: 64-bit Linux,
rustTarget: x86_64-unknown-linux-gnu,
runner: 'ubuntu-latest' }
- { displayName: ARM32 ARMv6 Linux,
rustTarget: arm-unknown-linux-gnueabi,
runner: 'ubuntu-latest' }
- { displayName: ARM32 ARMv7 Linux,
rustTarget: armv7-unknown-linux-gnueabihf,
runner: 'ubuntu-latest' }
- { displayName: ARM64 Linux,
rustTarget: aarch64-unknown-linux-gnu,
runner: 'ubuntu-latest' }
# macOS
- { displayName: 64-bit macOS,
rustTarget: x86_64-apple-darwin,
runner: 'macos-latest' }
runs-on: ${{ matrix.target.runner }}
steps:
# Get the machine ready to build
- name: Checkout Code
uses: actions/checkout@v4
- name: Add Rust Target
run: rustup target add ${{ matrix.target.rustTarget }}
- name: Update Sources
if: ${{ contains(matrix.target.rustTarget, 'linux') }}
run: sudo apt update
- name: Add Windows Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'pc-windows') }}
run: sudo apt install -y gcc-mingw-w64
- name: Add ARM32 Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'arm') }}
run: sudo apt install -y gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi gcc-arm-none-eabi binutils-arm-linux-gnueabi
- name: Add ARM64 Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'aarch64') }}
run: sudo apt install -y gcc-aarch64-linux-gnu crossbuild-essential-arm64
- name: Add 32-bit Linux Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'i686-unknown-linux-gnu') }}
run: sudo apt install -y gcc-multilib
# Build time
- name: Build
run: cargo build --release --target ${{ matrix.target.rustTarget }}
- name: Upload Asset
uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}
path: ./target/${{ matrix.target.rustTarget }}/release/${{ env.APP_NAME }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}
- name: Upload Release Asset
if: github.event_name == 'release'
id: upload-release-asset
env:
GH_TOKEN: ${{ github.token }}
run: |
cp ./target/${{ matrix.target.rustTarget }}/release/${{ env.APP_NAME }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} ./${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} &&
gh release upload ${{ github.event.release.tag_name }} ./${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}#"${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} (${{ matrix.target.displayName }})"