Skip to content

Commit 1820b0b

Browse files
Initial commit
0 parents  commit 1820b0b

File tree

15 files changed

+1071
-0
lines changed

15 files changed

+1071
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Workflow to cleanup projects created from this template
2+
# Adapted from workflow of the same name in https://github.com/JetBrains/intellij-platform-plugin-template
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Template Cleanup
6+
on:
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
# Triggered on first push to repos created from the template
12+
template-cleanup:
13+
name: Template Cleanup
14+
permissions:
15+
contents: write
16+
runs-on: ubuntu-latest
17+
if: github.event.repository.name != 'chisel-template'
18+
steps:
19+
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
# These are needed to make ad-m/github-push-action work
24+
# https://github.com/ad-m/github-push-action/tree/d91a481090679876dfc4178fef17f286781251df#example-workflow-file
25+
persist-credentials: false
26+
fetch-depth: 0
27+
28+
- name: Cleanup
29+
run: |
30+
export LC_CTYPE=C
31+
export LANG=C
32+
33+
# Prepare variables
34+
NAME="${GITHUB_REPOSITORY##*/}"
35+
ORG="$GITHUB_REPOSITORY_OWNER"
36+
SAFE_ORG=$(echo $ORG | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]')
37+
GROUP="com.github.$SAFE_ORG"
38+
39+
# Prepare wrapped name
40+
WRAPPED_NAME="\`${NAME}\`"
41+
42+
# Replace placeholders
43+
sed -i "s/%NAME%/$NAME/g" build.sbt README.md src/test/scala/gcd/*
44+
sed -i "s/%NAME%/$WRAPPED_NAME/g" build.mill
45+
sed -i "s/%REPOSITORY%/${GITHUB_REPOSITORY/\//\\/}/g" README.md
46+
sed -i "s/%ORGANIZATION%/$GROUP/g" build.sbt
47+
48+
# Remove lines marked with #REMOVE-ON-CLEANUP#
49+
sed -i '/#REMOVE-ON-CLEANUP#/d' README.md
50+
51+
rm -rf \
52+
.github/workflows/template-cleanup.yml \
53+
LICENSE
54+
55+
- name: Commit
56+
run: |
57+
git config --local user.email "action@github.com"
58+
git config --local user.name "GitHub Action"
59+
git add .
60+
git commit -m "Template cleanup"
61+
62+
- name: Push changes
63+
uses: ad-m/github-push-action@v0.8.0
64+
with:
65+
branch: main
66+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
branches: ['main']
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
ci:
12+
name: ci
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Cleanup
18+
run: sed -i "s/%NAME%/test/g" build.mill
19+
- name: Cache Scala
20+
uses: coursier/cache-action@v6
21+
- name: Setup Scala
22+
uses: coursier/setup-action@v1
23+
with:
24+
jvm: adopt:11
25+
apps: sbt
26+
- name: Setup Dependencies
27+
run: |
28+
sudo apt-get install verilator
29+
verilator --version
30+
- name: SBT Test
31+
run: sbt test
32+
- name: mill Test
33+
run: ./mill _.test

0 commit comments

Comments
 (0)