-
Notifications
You must be signed in to change notification settings - Fork 55
114 lines (111 loc) · 3.14 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Main
on:
push:
branches:
- '*'
tags-ignore:
- v*
pull_request:
release:
types:
- created
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-22.04
- macOS-13
- windows-2022
steps:
- uses: actions/checkout@v4
- 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: f31d0dcbc5ddcd97e1e2e6f7bc7eb0f5a547fe16
steps:
- uses: actions/checkout@v4
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install bison autoconf
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 ${{ env.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
make test
release:
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
uses: actions/upload-release-asset@v1.0.2
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