-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (84 loc) · 3.43 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
# SPDX-FileCopyrightText: 2022 - 2023 Serdar Sayın <https://serdarsayin.com>
#
# SPDX-License-Identifier: MIT
name: build
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
types: [ opened, synchronize, reopened ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-latest]
build_type: [Debug, Release]
env:
RISCV32_TOOLCHAIN_GZIP: riscv32-embecosm-gcc-ubuntu2204-20230430
RISCV32_TOOLCHAIN_URL: https://buildbot.embecosm.com/job/riscv32-gcc-ubuntu2204/60/artifact/riscv32-embecosm-gcc-ubuntu2204-20230430.tar.gz
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup prerequisites
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update -y
sudo apt install -y gcc-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo apt-get install -y libboost-dev ninja-build gcovr
- name: Set up msbuild
uses: microsoft/setup-msbuild@v1.1
if: ${{ runner.os == 'Windows' }}
- name: Build
if: ${{ runner.os == 'Windows' }}
run: |
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -S . -B ${{matrix.build_type}}
cd ${{matrix.build_type}}
MSBuild.exe riscv32-sim.sln
- name: Cache RV32 GCC Toolchain
id: cache-riscv-toolchain
if: ${{ runner.os == 'Linux' }}
uses: actions/cache@v3
with:
path: ~/.riscv-gcc
key: ${{ runner.os }}-riscv-gcc
restore-keys: ${{ runner.os }}-riscv-gcc
- name: Download & Extract RISCV32 GCC Toolchain
if: ${{ (runner.os == 'Linux') && (steps.cache-riscv-toolchain.outputs.cache-hit != 'true') }}
shell: bash
run: |
mkdir -p $HOME/.riscv-gcc
wget -q ${{env.RISCV32_TOOLCHAIN_URL}}
tar xf ${{env.RISCV32_TOOLCHAIN_GZIP}}.tar.gz -C $HOME/.riscv-gcc/
- name: Set up ENV
if: ${{ runner.os == 'Linux' }}
run: echo "$HOME/.riscv-gcc/${{env.RISCV32_TOOLCHAIN_GZIP}}/bin" >> $GITHUB_PATH
- name: Cache riscv-tests
id: cache-riscv-tests
if: ${{ runner.os == 'Linux' }}
uses: actions/cache@v3
with:
path: ~/.riscv-gcc/${{env.RISCV32_TOOLCHAIN_GZIP}}/share
key: ${{ runner.os }}-riscv-tests
restore-keys: ${{ runner.os }}-riscv-tests
- name: Set-up riscv-tests
if: ${{ (runner.os == 'Linux') && (steps.cache-riscv-tests.outputs.cache-hit != 'true') }}
shell: bash
run: |
RISCV=$HOME/.riscv-gcc/${{env.RISCV32_TOOLCHAIN_GZIP}} bash ${{github.workspace}}/tools/build_riscv_tests.sh
- name: Build and Test with build.sh
shell: bash
if: ${{ runner.os == 'Linux' }}
run: |
bash ${{github.workspace}}/tools/build.sh ${{matrix.build_type}} ${{matrix.build_type}} \
$HOME/.riscv-gcc/${{env.RISCV32_TOOLCHAIN_GZIP}}/share/riscv-tests/isa
- name: Upload build logs
uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' }}
with:
name: build-logs-artifact
path: ${{matrix.build_type}}/log