Build #62
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: CI Build | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
PROJECT_NAME: "ropgadget-rs" | |
REPO: hugsy/ropgadget-rs | |
VERBOSE: "1" | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { os: ubuntu-latest, target: arm-unknown-linux-gnueabihf , use-cross: true , name: "linux_armv7"} | |
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu , use-cross: true , name: "linux_arm64"} | |
- { os: ubuntu-latest, target: i686-unknown-linux-gnu , use-cross: true , name: "linux_x86"} | |
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu , use-cross: true , name: "linux_x64"} | |
- { os: macos-latest, target: x86_64-apple-darwin , use-cross: false, name: "macos_x64"} | |
- { os: windows-latest, target: aarch64-pc-windows-msvc , use-cross: false, name: "windows_arm64"} | |
- { os: windows-latest, target: i686-pc-windows-msvc , use-cross: false, name: "windows_x86"} | |
- { os: windows-latest, target: x86_64-pc-windows-msvc , use-cross: false, name: "windows_x64"} | |
name: "${{ matrix.job.os }} / ${{ matrix.job.target }}" | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Install prerequisites | |
shell: bash | |
run: | | |
case ${{ matrix.job.target }} in | |
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; | |
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
esac | |
- name: Install Rust toolchain | |
run: | | |
rustup set profile minimal | |
rustup toolchain install nightly | |
rustup override set stable | |
rustup target add ${{ matrix.job.target }} | |
- name: Show version information (Rust, cargo, GCC) | |
shell: bash | |
run: | | |
gcc --version || true | |
rustup -V | |
rustup toolchain list | |
rustup default | |
cargo -V | |
rustc -V | |
- name: Build (non-Windows) | |
if: ${{ matrix.job.os != 'windows-latest' }} | |
run: | | |
case ${{ matrix.job.use-cross }} in | |
true) cargo install cross; cross build --release --target=${{ matrix.job.target }} ;; | |
false) cargo build --release --target=${{ matrix.job.target }} ;; | |
*) echo "Unknown ${{ matrix.job.use-cross }}"; exit 1 ;; | |
esac | |
- name: Build (Windows) | |
if: ${{ matrix.job.os == 'windows-latest' }} | |
run: | | |
cargo build --release --target=${{ matrix.job.target }} | |
- name: Prepare artifact | |
shell: bash | |
run: | | |
mkdir build | |
cargo install --path . --root build | |
- name: Publish artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PROJECT_NAME}}_${{ matrix.job.name }}_${{ env.GITHUB_SHA_SHORT }} | |
path: build/bin | |
notify: | |
runs-on: 'ubuntu-22.04' | |
needs: build | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Send Discord notification | |
env: | |
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ env.GITHUB_SHA_SHORT }}" | |
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}" | |
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ env.GITHUB_REF_SLUG }}" | |
AUTHOR_URL: "https://github.com/${{ github.actor }}" | |
uses: sarisia/[email protected] | |
with: | |
nodetail: true | |
title: 🚧 Build `${{ env.GITHUB_SHA_SHORT }}` for `${{ env.REPO }}` 🚧 | |
description: | | |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ env.GITHUB_SHA_SHORT }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}): | |
● Commit [${{ env.GITHUB_SHA_SHORT }}](${{ env.COMMIT_URL }}) | |
● Branch [`${{ env.GITHUB_REF_SLUG }}`](${{ env.BRANCH_URL }}) | |
● [Detail Page](${{ env.RUN_URL }}) | |
color: 0x0000ff | |
username: ${{ github.actor }} via GithubBot | |
avatar_url: ${{ github.actor.avatar_url }} | |
test: | |
runs-on: 'ubuntu-22.04' | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: cargo check | |
run: cargo check | |
- name: cargo test | |
run: cargo test | |