-
Notifications
You must be signed in to change notification settings - Fork 55
178 lines (158 loc) · 6.33 KB
/
trik-toolchain.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
167
168
169
170
171
172
173
174
175
176
177
178
name: 'TRIK toolchain on Ubuntu Latest'
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
trik-toolchain:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
trik-version: ['', 'trik_new_age']
defaults:
run:
shell: bash -l {0} # to force import of ~/.bash_profile
env:
SDK_DOWNLOAD_URL: https://dl.trikset.com/distro/${{ matrix.trik-version == 'trik_new_age' && 'kirkstone' || 'latest-full' }}
TRIK_SDK_FILENAME: trik-sdk-x86_64-arm926ejse-toolchain-trik-nodistro.0.sh
steps:
- name: Restore TRIK toolchain
uses: actions/cache/restore@v4
with:
path: /opt/trik-sdk
key: ${{ matrix.trik-version }}_sdk
- name: Check if TRIK toolchain is up-to-date
id: trik-toolchain-check
run: |
curl -O ${SDK_DOWNLOAD_URL}/${TRIK_SDK_FILENAME}.sha256
diff -qN ${TRIK_SDK_FILENAME}.sha256 \
/opt/trik-sdk/${TRIK_SDK_FILENAME}.sha256 \
&& echo "install=false" >> $GITHUB_OUTPUT \
|| echo "install=true" >> $GITHUB_OUTPUT
- name: Check if hash of TRIK toolchain is up-to-date
run: |
getFileTimestamp () {
curl -s --head ${SDK_DOWNLOAD_URL}/${TRIK_SDK_FILENAME}${1:-""} \
| sed -n 's/^Last-Modified: //Ip' \
| xargs -I {} date -d "{}" +%s
}
timestampSHA256=$(getFileTimestamp .sha256)
timestampShellScript=$(getFileTimestamp)
if [[ $timestampSHA256 -lt $timestampShellScript ]]; then
echo "::warning ::The SDK installation script file is newer than its hash. Please update the hash."
fi
- name: Install TRIK toolchain
if: steps.trik-toolchain-check.outputs.install == 'true'
run: |
rm -rf /opt/trik-sdk
curl -O ${SDK_DOWNLOAD_URL}/${TRIK_SDK_FILENAME}
chmod +x ./${TRIK_SDK_FILENAME}
./${TRIK_SDK_FILENAME} -y
mv "${TRIK_SDK_FILENAME}.sha256" /opt/trik-sdk
- name: Save TRIK toolchain
if: steps.trik-toolchain-check.outputs.install == 'true'
uses: actions/cache/save@v4
with:
path: /opt/trik-sdk
key: ${{ matrix.trik-version }}_sdk
- name: Install QEMU with binfmt
run: |
sudo apt update
sudo apt install -y qemu-user-binfmt
- name: Configure git
run: |
git --version
git config --global core.symlinks true
git config --global core.autocrlf false
#prepare for actions/checkout, otherwise it fails
echo "LC_ALL=en_US.utf8" >> $GITHUB_ENV
echo "$(dirname $(realpath $(which git)))" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PERL5LIB=$PERL5LIB" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Use ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.ref_name }}-${{ github.job }}
- name: Check available tools
run: |
set -xeo pipefail
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
uname -a
rsync --version
qmake --version && qmake -query
python3 --version
echo $CXX
$CXX --version
ccache --version
qemu-arm --version
- name: "[TRIK controller] QMake"
timeout-minutes: 1
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
mkdir build-brick
cd build-brick
qmake CONFIG+=release CONFIG+=force_debug_info CONFIG+=precompile_header \
PKGCONFIG+=python3${{ matrix.trik-version && '-embed' || '' }} \
PYTHON_VERSION=$(python3 --version | grep -o '3\.[^.]\+') \
CONFIG+="${{ matrix.trik-version }}" \
"$GITHUB_WORKSPACE/"
- name: "[TRIK controller] QMake all"
timeout-minutes: 3
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
cd build-brick
make -j $(nproc) qmake_all
- name: "[TRIK controller] Make all"
timeout-minutes: 10
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
cd build-brick
make -j $(nproc) all
- name: "[QEMU + Tests] QMake"
timeout-minutes: 1
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
mkdir build-qemu
cd build-qemu
qmake CONFIG+=release CONFIG+=tests \
CONFIG+=force_debug_info CONFIG+=precompile_header \
CONFIG+=${{ matrix.trik-version || 'trik_nopython' }} \
CONFIG+=trik_not_brick \
PKGCONFIG+=python3${{ matrix.trik-version && '-embed' || '' }} \
PYTHON_VERSION=$(python3 --version | grep -o '3\.[^.]\+') \
"$GITHUB_WORKSPACE/"
- name: "[QEMU + Tests] QMake all"
timeout-minutes: 3
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
cd build-qemu
make -j $(nproc) qmake_all
- name: "[QEMU + Tests] Make all"
timeout-minutes: 10
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
cd build-qemu
make -j $(nproc) all
- name: "[QEMU + Tests] Unit tests"
timeout-minutes: 5
run: |
. /opt/trik-sdk/environment-setup-arm926ejse-oe-linux-gnueabi
cd build-qemu
# PYTHONDEVMODE=1 only from 3.7, overrides PYTHONMALLOC and some other
export QEMU_SET_ENV=LD_LIBRARY_PATH=${PWD}/bin,PYTHONDEVMODE=1,TRIK_PYTHONPATH=$(python3 -c "import sys; import os; print(os.pathsep.join(sys.path))"),PYTHONVERBOSE=2,PYTHONDEBUG=2,PYTHONMALLOC=malloc_debug,PYTHONFAULTHANDLER=1
export QEMU_LD_PREFIX=/opt/trik-sdk/sysroots/arm926ejse-oe-linux-gnueabi
env | sort
make -k check