-
Notifications
You must be signed in to change notification settings - Fork 14
119 lines (104 loc) · 3.66 KB
/
toolchain_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
name: Build toolchains
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
env:
ARTIFACT_STAGING_DIR: artifact
jobs:
build:
strategy:
matrix:
include:
- name: rv32imcb
display_name: Toolchains targeting Ibex with bit-manipulation extensions
target: riscv32-unknown-elf
output_dir: /tools/riscv
march: rv32imc_zba_zbb_zbc_zbs
mabi: ilp32
mcmodel: medany
- name: rv64imac
display_name: GCC and Clang/LLVM toolchains targeting RV64IMAC (Muntjac)
target: riscv64-unknown-elf
output_dir: /tools/riscv
march: rv64imac
mabi: lp64
mcmodel: medany
# - name: multilib-baremetal
# display_name: RV64 GCC (Multilib Baremetal)
# target: riscv64-unknown-elf
# output_dir: /opt/riscv-baremetal-toolchain
# - name: multilib-linux
# display_name: RV64 GCC (Multilib Linux)
# target: riscv64-unknown-linux-gnu
# output_dir: /opt/riscv-linux-toolchain
name: ${{ matrix.display_name }}
runs-on: ubuntu-latest
# This is a CentOS 7 based image
container: quay.io/pypa/manylinux2014_x86_64
timeout-minutes: 360
steps:
# This uses checkout v3 instead of v4 because GitHub actions's nodejs 20 currently does not work on CentOS 7.
- uses: actions/checkout@v3
- name: Setup environment
run: |
echo ::group::Install dependencies
./prepare-centos-7.sh
echo ::endgroup::
echo ::group::Install crosstool-ng
./install-crosstool-ng.sh
echo ::endgroup::
echo Preparing toolchain destination directory...
sudo mkdir -p /tools/riscv
sudo chmod 0777 /tools/riscv
echo ::group::Set the release tag env var
echo "RELEASE_TAG=$(./release_tag.sh)" >> "$GITHUB_ENV"
echo ::endgroup::
echo Creating artifact staging directory...
mkdir "$ARTIFACT_STAGING_DIR"
- name: Build GCC toolchain
run: |
./build-gcc-with-args.sh \
"lowrisc-toolchain-gcc-${{ matrix.name }}" \
"${{ matrix.target }}" \
"${{ matrix.output_dir }}" \
"${{ matrix.march }}" \
"${{ matrix.mabi}}" \
"${{ matrix.mcmodel }}" \
"${{ matrix.cflags }}"
- name: Build Clang toolchain
run: |
./build-clang-with-args.sh \
"lowrisc-toolchain-${{ matrix.name }}" \
"${{ matrix.target }}" \
"${{ matrix.output_dir }}" \
"${{ matrix.march }}" \
"${{ matrix.mabi}}" \
"${{ matrix.mcmodel }}" \
"${{ matrix.cflags }}"
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-toolchains
path: ${{ env.ARTIFACT_STAGING_DIR }}
- name: Check tarballs
run: |
set -e
for f in "${ARTIFACT_STAGING_DIR}"/*.tar.xz; do
./check-tarball.sh "$f"
done
- name: Release
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{ github.token }}
run: |
# Create the release if it doesn't already exist.
gh release create "$RELEASE_TAG" --prerelease || echo "release exists"
# Upload this job's artifacts.
gh release upload "$RELEASE_TAG" --clobber \
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-${{ matrix.name }}-${RELEASE_TAG}.tar.xz" \
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-gcc-${{ matrix.name }}-${RELEASE_TAG}.tar.xz"