Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
add chisel template
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed Feb 23, 2024
1 parent 52f53da commit 893f9c2
Show file tree
Hide file tree
Showing 30 changed files with 771 additions and 1,344 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/template-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Workflow to cleanup projects created from this template
# Adapted from workflow of the same name in https://github.com/JetBrains/intellij-platform-plugin-template
# SPDX-License-Identifier: Apache-2.0

name: Template Cleanup
on:
push:
branches: [main]

jobs:
# Triggered on first push to repos created from the template
template-cleanup:
name: Template Cleanup
permissions:
contents: write
runs-on: ubuntu-latest
if: github.event.repository.name != 'chisel-template'
steps:

- name: Checkout
uses: actions/checkout@v4
with:
# These are needed to make ad-m/github-push-action work
# https://github.com/ad-m/github-push-action/tree/d91a481090679876dfc4178fef17f286781251df#example-workflow-file
persist-credentials: false
fetch-depth: 0

- name: Cleanup
run: |
export LC_CTYPE=C
export LANG=C
# Prepare variables
NAME="${GITHUB_REPOSITORY##*/}"
ORG="$GITHUB_REPOSITORY_OWNER"
SAFE_ORG=$(echo $ORG | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
GROUP="com.github.$SAFE_ORG"
# Replace placeholders
sed -i "s/%NAME%/$NAME/g" build.sbt build.sc README.md src/test/scala/gcd/*
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" README.md
sed -i "s/%ORGANIZATION%/$GROUP/g" build.sbt
# Remove lines marked with #REMOVE-ON-CLEANUP#
sed -i '/#REMOVE-ON-CLEANUP#/d' README.md
rm -rf \
.github/workflows/template-cleanup.yml \
LICENSE
- name: Commit
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Template cleanup"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Continuous Integration

on:
push:
tags: ['*']
branches: ['main']
pull_request:
workflow_dispatch:

env:
verilator-version: v5.012
verilator-install-dir: verilator-install

jobs:
ci:
name: ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cleanup
run: sed -i "s/%NAME%/test/g" build.sc
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
jvm: adopt:11
apps: sbt mill
- name: Setup Dependencies
run: |
sudo apt-get install ccache
- name: Get Cached Verilator
id: get-cached-verilator
uses: actions/cache@v4
with:
path: ${{ env.verilator-install-dir }}
key: verilator-${{ env.verilator-version }}
- name: Install Verilator
if: steps.get-cached-verilator.outputs.cache-hit != 'true'
run: |
sudo apt-get install git help2man perl python3 make autoconf g++ flex bison numactl perl-doc libfl-dev
git clone https://github.com/verilator/verilator
unset VERILATOR_ROOT
cd verilator
git checkout ${{ env.verilator-version }}
autoconf
./configure --prefix=$(pwd)/../${{ env.verilator-install-dir }}
make
make install
- name: Set PATH
run: |
echo "$(pwd)/${{ env.verilator-install-dir }}/bin" >> $GITHUB_PATH
echo VERILATOR_ROOT="$(pwd)/${{ env.verilator-install-dir }}/share/verilator" >> $GITHUB_ENV
ln -sf $(pwd)/${{ env.verilator-install-dir }}/bin/verilator_bin $(pwd)/${{ env.verilator-install-dir }}/share/verilator/verilator_bin
- name: SBT Test
run: sbt test
- name: mill Test
run: mill _.test
Loading

0 comments on commit 893f9c2

Please sign in to comment.