mirror of https://github.com/zachjs/sv2v.git
105 lines
2.8 KiB
YAML
105 lines
2.8 KiB
YAML
name: Build and Test
|
|
on:
|
|
push:
|
|
pull_request:
|
|
release:
|
|
types:
|
|
- created
|
|
jobs:
|
|
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-18.04
|
|
- macOS-10.15
|
|
- windows-2019
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: mstksg/setup-stack@v2
|
|
- name: Build
|
|
run: make
|
|
- name: Prepare Artifact
|
|
shell: bash
|
|
run: cp LICENSE NOTICE README.md bin
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: ${{ runner.os }}
|
|
path: bin
|
|
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-18.04
|
|
- macOS-10.15
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Install Dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: brew install shunit2 icarus-verilog
|
|
- name: Install Dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get install -y shunit2 flex bison autoconf gperf
|
|
- name: Cache iverilog (Linux)
|
|
uses: actions/cache@v1
|
|
if: runner.os == 'Linux'
|
|
with:
|
|
path: ~/.local
|
|
key: ${{ runner.OS }}-iverilog-10-3
|
|
restore-keys: ${{ runner.OS }}-iverilog-10-3
|
|
- name: Install iverilog (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
if [ ! -e "$HOME/.local/bin/iverilog" ]; then
|
|
curl -L https://github.com/steveicarus/iverilog/archive/v10_3.tar.gz > iverilog-10_3.tar.gz
|
|
tar -xzf iverilog-10_3.tar.gz
|
|
cd iverilog-10_3
|
|
autoconf
|
|
./configure --prefix=$HOME/.local
|
|
make
|
|
make install
|
|
cd ..
|
|
fi
|
|
- name: Download Artifact
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: ${{ runner.os }}
|
|
path: bin
|
|
- name: Test
|
|
run: |
|
|
chmod +x bin/sv2v
|
|
export PATH="$PATH:$HOME/.local/bin"
|
|
make test
|
|
|
|
release:
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
matrix:
|
|
name: [macOS, Linux, Windows]
|
|
needs: build
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- name: Download Artifact
|
|
uses: actions/download-artifact@v1
|
|
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
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./sv2v-${{ matrix.name }}.zip
|
|
asset_name: sv2v-${{ matrix.name }}.zip
|
|
asset_content_type: application/zip
|