Commit 279a19ab by Zachary Snow

refactored CI workflow

- added Windows build
- separate build and test jobs
- per-OS release artifact generation
parent 1687b1c5
name: Build and Test name: Build and Test
on: on:
push: push:
pull_request:
release: release:
types: types:
- created - created
jobs: 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: test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, macOS-latest] os:
- ubuntu-18.04
- macOS-10.15
needs: build
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install Dependencies - name: Install Dependencies (macOS)
run: | if: runner.os == 'macOS'
brew install haskell-stack shunit2 icarus-verilog || ls run: brew install shunit2 icarus-verilog
sudo apt-get install -y haskell-stack shunit2 flex bison autoconf gperf || ls - name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y shunit2 flex bison autoconf gperf
- name: Cache iverilog - name: Cache iverilog
uses: actions/cache@v1 uses: actions/cache@v1
if: runner.os == 'Linux'
with: with:
path: ~/.local path: ~/.local
key: ${{ runner.OS }}-iverilog-10-3 key: ${{ runner.OS }}-iverilog-10-3
restore-keys: ${{ runner.OS }}-iverilog-10-3 restore-keys: ${{ runner.OS }}-iverilog-10-3
- name: Install iverilog - name: Install iverilog
if: runner.os == 'Linux'
run: | run: |
if [ "${{ runner.OS }}" = "Linux" ] && [ ! -e "$HOME/.local/bin/iverilog" ]; then if [ ! -e "$HOME/.local/bin/iverilog" ]; then
curl -L https://github.com/steveicarus/iverilog/archive/v10_3.tar.gz > iverilog-10_3.tar.gz curl -L https://github.com/steveicarus/iverilog/archive/v10_3.tar.gz > iverilog-10_3.tar.gz
tar -xzf iverilog-10_3.tar.gz tar -xzf iverilog-10_3.tar.gz
cd iverilog-10_3 cd iverilog-10_3
...@@ -35,58 +65,46 @@ jobs: ...@@ -35,58 +65,46 @@ jobs:
make install make install
cd .. cd ..
fi fi
- name: Build - name: Download Artifact
run: make uses: actions/download-artifact@v1
with:
name: ${{ runner.os }}
path: bin
- name: Mark Binary Executable
run: chmod +x bin/sv2v
- name: Test - name: Test
run: | run: |
export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/.local/bin"
make test make test
- name: Prepare Artifact
if: github.event_name == 'release'
run: cp LICENSE NOTICE README.md bin
- name: Upload Artifact
if: github.event_name == 'release'
uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}
path: bin
release: release:
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
needs: test strategy:
matrix:
os:
- ubuntu-18.04
- macOS-10.15
- windows-2019
needs: build
if: github.event_name == 'release' if: github.event_name == 'release'
steps: steps:
- run: sudo apt-get install -y tree - name: Download Artifact
- name: Download Linux Artifact
uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
with: with:
name: Linux name: ${{ runner.os }}
path: sv2v-Linux path: sv2v-${{ runner.os }}
- name: Download MacOS Artifact - name: Mark Binary Executable
uses: actions/download-artifact@v1 if: runner.os == 'macOS' || runner.os == 'Linux'
with: run: chmod +x */sv2v
name: macOS - name: Create ZIP
path: sv2v-macOS shell: bash
- name: Create ZIPs run: zip -r sv2v-${{ runner.os }} ./sv2v-${{ runner.os }}
run: | - name: Upload Release Asset
chmod +x */sv2v
zip -r sv2v-Linux ./sv2v-Linux
zip -r sv2v-macOS ./sv2v-macOS
- name: Upload Linux 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-Linux.zip
asset_name: sv2v-Linux.zip
asset_content_type: application/zip
- name: Upload MacOS Release Asset
uses: actions/upload-release-asset@v1.0.1 uses: actions/upload-release-asset@v1.0.1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: ./sv2v-macOS.zip asset_path: ./sv2v-${{ runner.os }}.zip
asset_name: sv2v-macOS.zip asset_name: sv2v-${{ runner.os }}.zip
asset_content_type: application/zip asset_content_type: application/zip
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment