Main #658
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: Main | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- v* | |
pull_request: | |
release: | |
types: | |
- created | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macOS-13 | |
- windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Install Dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: brew install haskell-stack | |
- name: Build | |
run: make | |
- name: Prepare Artifact | |
shell: bash | |
run: cp LICENSE NOTICE README.md CHANGELOG.md bin | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }} | |
path: bin | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macOS-13 | |
needs: build | |
env: | |
IVERILOG_REF: cbdaa865a10ce69d7c528cb2aa4c571641de0c62 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Install Dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install bison | |
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH | |
- name: Install Dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: sudo apt-get install -y flex bison autoconf gperf | |
- name: Cache iverilog | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: ${{ runner.os }}-${{ env.IVERILOG_REF }} | |
restore-keys: ${{ runner.os }}-${{ env.IVERILOG_REF }} | |
- name: Install iverilog | |
run: | | |
if [ ! -e "$HOME/.local/bin/iverilog" ]; then | |
git clone https://github.com/steveicarus/iverilog.git | |
cd iverilog | |
git checkout $IVERILOG_REF | |
autoconf | |
./configure --prefix=$HOME/.local | |
make -j2 | |
make install | |
cd .. | |
fi | |
curl -L https://raw.githubusercontent.com/kward/shunit2/v2.1.8/shunit2 > ~/.local/bin/shunit2 | |
chmod +x ~/.local/bin/shunit2 | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ runner.os }} | |
path: bin | |
- name: Test | |
run: | | |
chmod +x bin/sv2v | |
# rebuild and upload a code coverage report on scheduled linux runs | |
make ${{ github.event_name == 'schedule' && runner.os == 'Linux' && 'coverage' || 'test' }} | |
- name: Upload Coverage | |
uses: actions/upload-artifact@v4 | |
if: hashFiles('.hpc/*.html') != '' | |
with: | |
name: coverage | |
path: .hpc/*.html | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
name: [macOS, Linux, Windows] | |
needs: build | |
if: github.event_name == 'release' | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.name }} | |
path: sv2v-${{ matrix.name }} | |
- name: Mark Binary Executable | |
run: chmod +x */sv2v* | |
- name: Create ZIP | |
run: zip -r sv2v-${{ matrix.name }} ./sv2v-${{ matrix.name }} | |
- name: Upload Release Asset | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPO: ${{ github.repository }} | |
run: gh release upload ${{ github.event.release.tag_name }} sv2v-${{ matrix.name }}.zip |