-
Notifications
You must be signed in to change notification settings - Fork 607
64 lines (61 loc) · 2.02 KB
/
build-scala-cli-example.yml
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
name: Build and Test Chisel Scala-CLI Example
on:
workflow_call:
inputs:
circt:
description: 'The version of CIRCT to use'
type: string
jobs:
build_example:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
# Need to fetch full history for deriving version
with:
fetch-depth: 0
- name: Install CIRCT
id: install-circt
if: ${{ inputs.circt }}
uses: circt/install-circt@v1.1.1
with:
version: ${{ inputs.circt }}
github-token: ${{ github.token }}
# TODO have install-circt do this
- name: Set CHISEL_FIRTOOL_PATH
if: steps.install-circt.outcome == 'success'
run: |
dir=$(dirname $(which firtool))
echo "CHISEL_FIRTOOL_PATH=$dir" >> "$GITHUB_ENV"
- name: Cache Scala-CLI
uses: coursier/cache-action@v6
- name: Setup Scala-CLI
uses: VirtusLab/scala-cli-setup@v1
with:
jvm: adoptium:17
apps: sbt
- name: Generate Chisel Scala CLI Example
shell: bash
run: |
# Determine the version and insert it into the example
VERSION=$(./mill show unipublish.publishVersion | tr -d \")
sed "s/@VERSION@/$VERSION/g" .github/workflows/build-scala-cli-example/chisel-example.scala > chisel-example.scala
# If the version does NOT contain SNAPSHOT, remove line including snapshots repo
if ! grep -qi 'snapshot' <<< $VERSION; then
sed -i '1d' chisel-example.scala
fi
# Need to publishLocal to test the example
- name: Publish Local
shell: bash
run: |
./mill -i unipublish.publishLocal
- name: Test Scala CLI Example
shell: bash
run: scala-cli chisel-example.scala
- name: Upload Example
uses: actions/upload-artifact@v4
with:
name: chisel-example.scala
path: chisel-example.scala
retention-days: 7