-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.29 KB
/
main.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
name: Build and Lint
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
# 检出代码
- name: Checkout code
uses: actions/checkout@v2
# 设置 LoongArch 工具链
- name: Set up LoongArch toolchain
run: |
export PATH=/opt/loongarch32r-linux-gnusf-2022-05-20/bin:${PATH}
# 安装 Xilinx Vivado
- name: Install Xilinx Vivado 2019.2
run: |
mkdir -p /opt/xilinx
wget https://www.xilinx.com/support/download/index.html -O vivado_installer.tar.gz
tar -xzvf vivado_installer.tar.gz -C /opt/xilinx
/opt/xilinx/vivado/2019.2/installer/xsetup --silent --agree XilinxEULA --noexec
# 设置 Xilinx Vivado 环境
- name: Source Vivado environment
run: source /opt/xilinx/vivado/2019.2/settings64.sh
# 编译 asm 文件
- name: Build asm
run: make -C asm
# 运行 Linter
- name: Run linter
run: python3 ./.ci-scripts/run-linter.py project/thinpad_top.xpr 2>linter.log
# 检查提交差异并生成比特流
- name: Check diff and generate bitstream if needed
run: |
str="project/thinpad_top.srcs"
diff=""
git config --global --add safe.directory $(pwd)
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr
else
diff=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
fi
echo $diff
if [[ $diff =~ $str ]]; then
vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr
fi
# 验证比特流文件是否生成
- name: Verify bitstream
run: |
test -f project/thinpad_top.runs/impl_1/*.bit || vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr
test -f project/thinpad_top.runs/impl_1/*.bit
# 保存生成的工件,使用 v3 版本的 upload-artifact
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: bitstream-files
path: |
asm/*.bin
project/thinpad_top.runs/impl_1/*.bit
project/thinpad_top.runs/*/runme.log
linter.log