Publish unit test logs to GitHub Pages #100
Workflow file for this run
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: VeeR-EL2 verification | |
on: | |
push: | |
pull_request: | |
jobs: | |
verilator: | |
name: Build Verilator | |
runs-on: ubuntu-latest | |
env: | |
CCACHE_DIR: "/opt/veer-el2/.cache/" | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Install prerequisities | |
run: | | |
sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \ | |
git autoconf automake autotools-dev curl python3 python3-pip \ | |
libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex \ | |
texinfo gperf libtool patchutils bc zlib1g zlib1g-dev libexpat-dev \ | |
ninja-build ccache libfl2 libfl-dev help2man | |
- name: Create Cache Timestamp | |
id: cache_timestamp | |
uses: nanzm/[email protected] | |
with: | |
format: 'YYYY-MM-DD-HH-mm-ss' | |
- name: Setup cache | |
uses: actions/cache@v2 | |
timeout-minutes: 3 | |
continue-on-error: true | |
with: | |
path: "/opt/veer-el2/.cache/" | |
key: cache_${{ steps.cache_timestamp.outputs.time }} | |
restore-keys: cache_ | |
- name: Build Verilator | |
run: | | |
git clone https://github.com/verilator/verilator | |
pushd verilator | |
git checkout v5.008 | |
autoconf | |
./configure --prefix=/opt/verilator | |
make -j `nproc` | |
make install | |
popd | |
cd /opt && tar -czvf verilator.tar.gz verilator/ | |
- name: Store Verilator binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: verilator | |
path: /opt/*.tar.gz | |
retention-days: 1 | |
tests: | |
name: Verification tests | |
runs-on: ubuntu-latest | |
needs: verilator | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Setup repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
path: Caliptra | |
- name: Setup repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \ | |
git python3 python3-pip build-essential ninja-build cpanminus ccache \ | |
gcc-riscv64-unknown-elf | |
sudo cpanm Bit::Vector | |
pip3 install meson | |
pip3 install -r verification/requirements.txt | |
- name: Download verilator binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: verilator | |
path: /opt | |
- name: Unpack verilator binaries | |
run: | | |
cd /opt && tar -zxvf verilator.tar.gz | |
- name: Run tests | |
run: | | |
export PATH=/opt/verilator/bin:$PATH | |
export RV_ROOT=`pwd` | |
export PYTHONUNBUFFERED=1 | |
$RV_ROOT/configs/veer.config | |
pytest verification/test.py -v --timeout=480 --html=test.html --html=$GITHUB_STEP_SUMMARY | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: results | |
path: | | |
test.html | |
assets/ | |
sim_build/ | |
preview: | |
name: Preview results on GitHub Actions | |
runs-on: ubuntu-latest | |
needs: tests | |
concurrency: | |
group: gh-pages | |
steps: | |
- name: Get PR metadata | |
uses: 8BitJonny/[email protected] | |
if: github.event_name == 'pull_request' | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
id: PR | |
- name: Downloads results artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: results | |
path: ./results | |
- name: Download current release | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: ./public | |
- name: Prepare results for publishing | |
run: | | |
rm -r ./results/sim_build | |
mv ./results/test.html ./results/index.html | |
mkdir -p ./public/verification | |
mv ./results/* ./public/verification | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
# prepare metadata and upload artifacts for multi branch deployment | |
- name: Move deployment to the correct preview directory | |
if: github.event_name == 'pull_request' | |
run: | | |
mkdir ./preview | |
mv ./public/verification ./preview/${{ steps.PR.outputs.number }} | |
- name: Upload preview artifacts | |
uses: actions/upload-artifact@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
name: pr_deployment | |
path: ./preview/ |