Skip to content

Commit

Permalink
fix GitHub Actions setup
Browse files Browse the repository at this point in the history
- refresh GitHub Actions versions
- manually install shUnit2 v2.1.8
- more portable usage check
- run-all.sh exits on ctrl-c
  • Loading branch information
zachjs committed Apr 16, 2024
1 parent dc42659 commit 6226472
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- macOS-11
- windows-2019
- ubuntu-22.04
- macOS-13
- windows-2022
steps:
- uses: actions/checkout@v1
- 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@v1
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: bin
Expand All @@ -37,23 +40,23 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- macOS-11
- ubuntu-22.04
- macOS-13
needs: build
env:
IVERILOG_REF: f31d0dcbc5ddcd97e1e2e6f7bc7eb0f5a547fe16
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install shunit2 bison autoconf
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 shunit2 flex bison autoconf gperf
run: sudo apt-get install -y flex bison autoconf gperf
- name: Cache iverilog
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local
key: ${{ runner.OS }}-${{ env.IVERILOG_REF }}
Expand All @@ -70,27 +73,29 @@ jobs:
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@v1
uses: actions/download-artifact@v4
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-20.04
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@v1
uses: actions/download-artifact@v4
with:
name: ${{ matrix.name }}
path: sv2v-${{ matrix.name }}
Expand All @@ -99,7 +104,7 @@ jobs:
- name: Create ZIP
run: zip -r sv2v-${{ matrix.name }} ./sv2v-${{ matrix.name }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1.0.1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/notice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
- NOTICE
jobs:
notice:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Regenerate NOTICE
run: ./notice.sh > NOTICE
- name: Validate NOTICE
Expand Down
10 changes: 10 additions & 0 deletions test/help/check_usage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import subprocess

with open("../../README.md", "r") as file:
text_readme = file.read()

text_help = subprocess.check_output(["../../bin/sv2v", "--help"]).decode()
text_usage = "```\n" + "\n".join(text_help.split("\n")[2:-5]) + "\n```"

if text_usage not in text_readme:
raise RuntimeError(f"'{text_usage}' not found in '{text_readme}'")
9 changes: 1 addition & 8 deletions test/help/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ test_help() {
assertTrue "getting help should succeed" $result
assertNotNull "stdout should not be empty" "$stdout"
assertNull "stderr should be empty" "$stderr"
lines=`echo "$stdout" | wc -l`
usage=`echo "$stdout" | tail -n +3 | head -n $(expr $lines - 5)`
usage="\`\`\`
$usage
\`\`\`"
if [[ ! $(<../../README.md) = *"$usage"* ]]; then
fail "Did not find matching usage in README!"
fi
python3 check_usage.py
}

source ../lib/functions.sh
Expand Down
2 changes: 2 additions & 0 deletions test/run-all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

trap exit INT

cd `dirname "${BASH_SOURCE[0]}"`

failures=0
Expand Down

0 comments on commit 6226472

Please sign in to comment.