feat: add test stop #68
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: CI | |
on: | |
push: | |
tags: | |
# Regex for a version number such as 0.2.1 | |
- "[0-9]+.[0-9]+.[0-9]+" | |
permissions: | |
contents: write | |
jobs: | |
build-and-upload: | |
name: Build and upload | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
- build: windows-msvc | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get the release version from the tag | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Add win target | |
if: "${{ matrix.os == 'windows-latest' }}" | |
run: rustup target add x86_64-pc-windows-msvc | |
- name: Build Win | |
if: "${{ matrix.os == 'windows-latest' }}" | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Add Bundle | |
if: "${{ matrix.os == 'macos-latest' }}" | |
run: cargo install cargo-bundle | |
- name: Build Mac | |
if: "${{ matrix.os == 'macos-latest' }}" | |
working-directory: ./crates/netpurr | |
run: cargo bundle --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
# Replace with the name of your binary | |
binary_name="Netpurr" | |
dirname="${binary_name}-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
mv "target/${{ matrix.target }}/release/bundle/osx/$binary_name.app" "$dirname" | |
fi | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | |
fi | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
fi | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "$dirname.zip" "$dirname" | |
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ env.ASSET }} |