Make ropgadget-rs a library instead #80
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 | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
PROJECT_NAME: "ropgadget-rs" | |
REPO: hugsy/ropgadget-rs | |
VERBOSE: 1 | |
RUST_BACKTRACE: 1 | |
DEBUG_IN_CI: 0 | |
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/[email protected] | |
- 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 --lib --target=${{ matrix.job.target }} | |
cross build --example rp-rs --release --target=${{ matrix.job.target }} | |
;; | |
false) | |
cargo build --release --lib --target=${{ matrix.job.target }} | |
cargo build --example rp-rs --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 --lib | |
cargo build --release --target=${{ matrix.job.target }} --example rp-rs | |
- name: Run Interactive CI Debugger | |
if: ${{ matrix.job.os == 'ubuntu-latest' && env.DEBUG_IN_CI == '1' }} | |
run: curl -sSf https://sshx.io/get | sh -s run | |
- name: Publish artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{ env.PROJECT_NAME}}_${{ matrix.job.name }}_${{ github.sha }} | |
path: | | |
target/debug/examples/rp-rs* | |
target/debug/libropgadget_rs.* | |
target/release/examples/rp-rs* | |
target/release/libropgadget_rs.* | |
notify: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Send Discord notification | |
env: | |
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ github.sha }}" | |
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}" | |
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ github.ref_name }}" | |
AUTHOR_URL: "https://github.com/${{ github.actor }}" | |
AVATAR_URL: "https://camo.githubusercontent.com/9ddce666945f8c507d7c9a83aaa0518b36a47fa1fd9e823e061ed4753e7becdc/68747470733a2f2f692e696d6775722e636f6d2f7a6a63787956662e706e67" | |
uses: sarisia/[email protected] | |
with: | |
nodetail: true | |
title: 🚧 Build `${{ github.sha }}` for `${{ env.REPO }}` 🚧 | |
description: | | |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ github.sha }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}) was successful | |
color: 0x00ff00 | |
username: ${{ github.actor }} via GithubBot | |
avatar_url: ${{ env.AVATAR_URL }} | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/[email protected] | |
- run: cargo fmt | |
- run: cargo check | |
- run: cargo test | |