-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (125 loc) · 4.6 KB
/
Build.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
name: Build
on:
push:
branches: [ main, hydradancer ]
pull_request:
branches: [ main, hydradancer ]
env:
RISCV_GCC_PATH: /opt/gcc_riscv/xpack-riscv-none-elf-gcc-12.2.0-1/bin
jobs:
Firmware-build-and-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: |
git submodule update --init
cd submodules/wch-ch56x-lib
git submodule update --init
cd ../..
git fetch --prune --unshallow
- name: Cache GCC archive
uses: actions/cache@v3
with:
path: /opt/gcc_riscv
key: gcc-riscv-${{ runner.os }}-${{ hashFiles('xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz') }}
restore-keys: gcc-riscv-${{ runner.os }}-
- name: Use GCC archive cache
run: |
ls /opt/gcc_riscv/xpack-riscv-none-elf-gcc-12.2.0-1/bin/riscv-none-elf-gcc || true
- name: Restore GCC archive cache
if: steps.use-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /opt/gcc_riscv
wget https://github.com/hydrausb3/riscv-none-elf-gcc-xpack/releases/download/12.2.0-1/xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz
tar xvfz xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz -C /opt/gcc_riscv/
- name: Verify GCC installation
run: |
export PATH="$PATH:${{ env.RISCV_GCC_PATH }}"
riscv-none-elf-gcc --version
- name: Get build timestamp
id: id_date
shell: bash
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT
- name: Get app version + timestamp
id: id_version
run: echo "app_version=$(git describe --tags HEAD)-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build ${{ matrix.PROJECT_NAME }}
run: |
export PATH="$PATH:${{ env.RISCV_GCC_PATH }}"
cmake --toolchain ../cmake/wch-ch56x-toolchain.cmake -DCMAKE_BUILD_TYPE=release -DBUILD_TESTS=1 -DBUILD_TOOLS=1 -B build .
cmake --build build/
cmake --install build/
- name: Upload artifact all-firmwares${{steps.id_version.outputs.app_version}}
uses: actions/upload-artifact@v3
with:
name: all-firmwares${{steps.id_version.outputs.app_version}}
path: |
out/**/*.bin
out/**/*.elf
native_benchmarks:
runs-on: ubuntu-20.04
strategy:
matrix:
PROJECT_NAME: [test_loopback, test_speedtest]
steps:
- uses: actions/checkout@v3
- name: Checkout
run: |
git submodule update --init
git fetch --prune --unshallow
- name: Install prerequisites
run: |
set -x
sudo apt -q update
sudo apt install libusb-1.0-0-dev
- name: Get build timestamp
id: id_date
shell: bash
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT
- name: Get app version + timestamp
id: id_version
run: echo "app_version=$(git describe --tags HEAD)-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build app
shell: bash
run: |
cd hydradancer/tests/native/${{ matrix.PROJECT_NAME }}
make
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: native-${{ matrix.PROJECT_NAME }}${{steps.id_version.outputs.app_version}}
path: hydradancer/tests/native/${{ matrix.PROJECT_NAME }}/${{ matrix.PROJECT_NAME }}
facedancer_replacements:
runs-on: ubuntu-20.04
strategy:
matrix:
PROJECT_NAME: [facedancer_replacement_loopback, facedancer_replacement_speedtest]
steps:
- uses: actions/checkout@v3
- name: Checkout
run: |
git submodule update --init
git fetch --prune --unshallow
- name: Install prerequisites
run: |
set -x
sudo apt -q update
sudo apt install libusb-1.0-0-dev
- name: Get build timestamp
id: id_date
shell: bash
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT
- name: Get app version + timestamp
id: id_version
run: echo "app_version=$(git describe --tags HEAD)-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build app
shell: bash
run: |
cd hydradancer/tests/test_backend/${{ matrix.PROJECT_NAME }}
make
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: native-${{ matrix.PROJECT_NAME }}${{steps.id_version.outputs.app_version}}
path: hydradancer/tests/test_backend/${{ matrix.PROJECT_NAME }}/${{ matrix.PROJECT_NAME }}