Add and improve rules (#227) #68
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: Release Artifacts | |
on: | |
push: | |
branches: [ "main" ] | |
# Run when release tags are created | |
tags: [ "v*.*.*" ] | |
# allow manual triggering | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch | |
workflow_dispatch: | |
jobs: | |
native: | |
name: ${{ matrix.build }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: ubuntu-20.04.x86_64 | |
os: ubuntu-20.04 | |
rust: stable | |
install_dependencies: | | |
sudo apt-get install zsh libboost-all-dev | |
- build: ubuntu-22.04.arm64 | |
os: ubuntu-22.04-arm64-8-core | |
rust: stable | |
install_dependencies: | | |
sudo apt-get install zsh libboost-all-dev | |
- build: macos-13.x86_64 | |
os: macos-13 | |
rust: stable | |
install_dependencies: | | |
brew install coreutils boost | |
- build: macos-13.arm64 | |
os: macos-13-xlarge | |
rust: stable | |
install_dependencies: | | |
brew install coreutils boost | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install dependencies | |
run: ${{ matrix.install_dependencies }} | |
- name: Install Rust toolchain | |
id: install-rust-toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Build release | |
run: | | |
./scripts/create-release.zsh | |
- name: Run integration tests on release | |
run: | | |
NP_TEST_PROGRAM="$PWD"/release/bin/noseyparker cargo test --test test_noseyparker | |
env: | |
# We use the GitHub Actions automatic token when running tests, to avoid | |
# spurious failures from rate limiting when testing Nosey Parker's github | |
# enumeration capabilities. | |
NP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release archive | |
id: release-archive | |
run: | | |
FILENAME="$(./release/bin/noseyparker -V | tr ' ' '-').tar.gz" | |
tar -C release -c -z -f "$FILENAME" . | |
echo "filename=$FILENAME" >> "$GITHUB_OUTPUT" | |
- name: Upload release files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.release-archive.outputs.filename }} | |
path: ${{ steps.release-archive.outputs.filename }} | |
compression-level: 0 | |
if-no-files-found: error | |
# Build the Alpine-based Docker image, then copy it out of there to create a | |
# standalone release from that | |
linux-musl: | |
strategy: | |
matrix: | |
include: | |
- base: alpine | |
platform: linux/amd64 | |
platform-pair: linux-amd64 | |
runs-on: ubuntu-22.04 | |
- base: alpine | |
platform: linux/arm64 | |
platform-pair: linux-arm64 | |
runs-on: ubuntu-22.04-arm64-8-core | |
name: ${{ matrix.platform }} musl | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: docker/setup-buildx-action@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install zsh libboost-all-dev | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile.alpine | |
platforms: ${{ matrix.platform }} | |
tags: noseyparker | |
load: true | |
target: builder | |
- name: Copy release build from Docker container | |
run: | | |
docker run --name np noseyparker | |
docker cp np:/release release | |
docker rm np | |
- name: Run integration tests on release | |
run: | | |
NP_TEST_PROGRAM="$PWD"/release/bin/noseyparker cargo test --test test_noseyparker | |
env: | |
# We use the GitHub Actions automatic token when running tests, to avoid | |
# spurious failures from rate limiting when testing Nosey Parker's github | |
# enumeration capabilities. | |
NP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release archive | |
id: release-archive | |
run: | | |
FILENAME="$(./release/bin/noseyparker -V | tr ' ' '-').tar.gz" | |
tar -C release -c -z -f "$FILENAME" . | |
echo "filename=$FILENAME" >> "$GITHUB_OUTPUT" | |
- name: Upload release files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.release-archive.outputs.filename }} | |
path: ${{ steps.release-archive.outputs.filename }} | |
compression-level: 0 | |
if-no-files-found: error |