-
Notifications
You must be signed in to change notification settings - Fork 207
166 lines (138 loc) · 6.26 KB
/
test.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# This is a basic workflow to help you get started with Actions
name: CI test
# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the main & dev branch
pull_request:
branches: [ '**' ]
# Triggers the workflow on push events
push:
branches: [ '**' ]
# Allows you to run this workflow Actions manually
workflow_dispatch:
# Triggers the action 2am every day
schedule:
- cron: "0 2 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
ACT-sail-spike:
name: ACT-sail-spike (RV${{ matrix.xlen }})
runs-on: ubuntu-22.04
# Set a 15-minute time limit for this job
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
xlen: [32, 64]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-venv
sudo apt-get install -y gcc git autoconf automake libtool curl make unzip
sudo apt-get install -y 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-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev pkg-config
sudo apt-get install -y device-tree-compiler libboost-regex-dev libboost-system-dev
pip3 install git+https://github.com/riscv/riscof.git
- name: Build RISCV-GNU Toolchain (${{ matrix.xlen }} bit)
run: |
wget -c https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv${{ matrix.xlen }}-elf-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz
tar -xzf riscv${{ matrix.xlen }}-elf-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz
mv riscv riscv${{ matrix.xlen }}
echo $GITHUB_WORKSPACE/riscv${{ matrix.xlen }}/bin >> $GITHUB_PATH
- name: Install riscv-isac
run: |
cd riscv-isac
pip3 install --editable .
- name: Install riscv-ctg
run: |
cd riscv-ctg
pip3 install --editable .
- name: Get Latest Spike Commit
run: |
SPIKE_HASH=$(git ls-remote https://github.com/riscv/riscv-isa-sim.git HEAD | awk '{ print $1}')
echo "SPIKE_HASH=$SPIKE_HASH" >> "$GITHUB_ENV"
- name: Restore cached Spike
id: cache-spike-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/spike
key: spike-${{ env.SPIKE_HASH }}-RV${{ matrix.xlen }}
- name: Install Spike
if: steps.cache-spike-restore.outputs.cache-hit != 'true'
run: |
git clone https://github.com/riscv/riscv-isa-sim.git
cd riscv-isa-sim
mkdir build
cd build
../configure --prefix=$GITHUB_WORKSPACE/spike
make -j$(nproc)
make install
- name: Save cached Spike
if: steps.cache-spike-restore.outputs.cache-hit != 'true'
id: cache-spike-save
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/spike
key: ${{ steps.cache-spike-restore.outputs.cache-primary-key }}
- name: Get Latest Sail Commit
run: |
SAIL_HASH=$(git ls-remote https://github.com/riscv/sail-riscv.git HEAD | awk '{ print $1}')
echo "SAIL_HASH=$SAIL_HASH" >> "$GITHUB_ENV"
- name: Restore cached Sail
id: cache-sail-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/sail
key: sail-${{ env.SAIL_HASH }}-RV${{ matrix.xlen }}
- name: Install Sail
if: steps.cache-sail-restore.outputs.cache-hit != 'true'
run: |
sudo mkdir -p /usr/local
curl --location https://github.com/rems-project/sail/releases/download/0.18-linux-binary/sail.tar.gz | sudo tar xvz --directory=/usr/local --strip-components=1
git clone https://github.com/riscv/sail-riscv.git
cd sail-riscv
ARCH=RV${{ matrix.xlen }} make
mkdir -p $GITHUB_WORKSPACE/sail
mv c_emulator/riscv_sim_RV${{ matrix.xlen }} $GITHUB_WORKSPACE/sail/riscv_sim_RV${{ matrix.xlen }}
- name: Save cached Sail
if: steps.cache-sail-restore.outputs.cache-hit != 'true'
id: cache-sail-save
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/sail
key: ${{ steps.cache-sail-restore.outputs.cache-primary-key }}
- name: Set PATH
run: |
echo $GITHUB_WORKSPACE/spike/bin >> $GITHUB_PATH
echo $GITHUB_WORKSPACE/sail >> $GITHUB_PATH
- name: Config and run riscof for RV${{ matrix.xlen }}
run: |
cd riscof-plugins/rv${{ matrix.xlen }}
riscof run --config config.ini --suite ../../riscv-test-suite/rv${{ matrix.xlen }}i_m/ --env ../../riscv-test-suite/env
- name: Check size of riscof_work folder
id: check_size
run: |
folder_size=$(du -sm /home/runner/work/riscv-arch-test/riscv-arch-test/riscof-plugins/rv${{ matrix.xlen }}/riscof_work | cut -f1)
echo "Folder size: ${folder_size} MB"
if [ "$folder_size" -gt 1000 ]; then
echo "Size exceeds 1 GB. Skipping upload."
echo "upload=false" >> $GITHUB_ENV # Set an environment variable to skip upload
else
echo "Size is within limit. Proceeding with upload."
echo "upload=true" >> $GITHUB_ENV # Set an environment variable to proceed with upload
fi
# Upload the riscof_work for rv${{ matrix.xlen }} folder if size check passes
- name: Upload the riscof_work for rv${{ matrix.xlen }} folder
# Proceed with upload only if the size is within limit
if: ${{ env.upload == 'true' }}
uses: actions/upload-artifact@v4
with:
name: riscof-test-report-rv${{ matrix.xlen }}
path: /home/runner/work/riscv-arch-test/riscv-arch-test/riscof-plugins/rv${{ matrix.xlen }}/riscof_work/
if-no-files-found: warn
retention-days: 3
compression-level: 6
overwrite: true
include-hidden-files: false