Skip to content

feat: Automate SIPNET binary builds and manual release #129

feat: Automate SIPNET binary builds and manual release

feat: Automate SIPNET binary builds and manual release #129

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
jobs:
# Build and Integration Test
build:
strategy:
fail-fast: false
matrix:
OS:
- macos-latest
- ubuntu-latest
- ubuntu-20.04
runs-on: ${{ matrix.OS }}
steps:
# checkout source code
- uses: actions/checkout@v2
# install doxygen
- name: Install Doxygen
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get install doxygen -y
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install --formula doxygen
fi
# compile SIPNET
- name: compile sipnet
run: make
# remove existing test output file
- name: Remove Niwout Output File
run: rm Sites/Niwot/niwot.out
# run single sipnet run
- name: Run SIPNET on Sites/Niwot/niwot
run: ./sipnet
# check for correct output of Niwot run
- name: Check if niwot.out is generated
shell: bash
run: |
if [ ! -f Sites/Niwot/niwot.out ]; then
echo "::error title={No Output}::Test run for Niwot site failed to produce output"
exit 1
fi
# Check if niwot.out has changed
- name: Check whether niwot.out has changed
shell: bash
run: |
if git diff --exit-code Sites/Niwot/niwot.out; then
echo "Success: Niwot.out created and has not changed"
else
echo "::error title={Output Changed}::The test file niwot.out has changed. This is expected to fail with some changes to SIPNET. When this happens, assess correctness and then update the reference niwot.out."
exit 1
fi
# upload SIPNET binaries
- name: Upload SIPNET Binaries
uses: actions/upload-artifact@v2
with:
name: sipnet-binaries
path: ./sipnet
# Run Unit Tests
test:
needs: build
strategy:
fail-fast: false
matrix:
OS:
- macos-latest
- ubuntu-latest
- ubuntu-20.04
runs-on: ${{ matrix.OS }}
steps:
# checkout source code
- uses: actions/checkout@v2
# compile unit tests
- name: compile tests
run: make test
# run tests
- name: Run Unit Tests
run: make testrun
# Create Release
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sipnet
asset_name: sipnet
asset_content_type: application/octet-stream