-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
91 lines (82 loc) · 2.64 KB
/
action.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
name: Setup GCC Linaro Toolchain
description: This action sets up the GCC Linaro toolchain on Windows containers.
author: vinicius-smartme
inputs:
version:
description: 'Linaro GCC version (4, 5, 6, or 7).'
required: true
default: '7'
options:
- 4
- 5
- 6
- 7
type: choice
toolchain:
description: 'Target ARM toolchain.'
required: true
options:
- aarch64-elf
- aarch64-linux-gnu
- aarch64_be-elf
- aarch64_be-linux-gnu
- arm-eabi
- arm-linux-gnueabi
- arm-linux-gnueabihf
- armeb-eabi
- armeb-linux-gnueabi
- armeb-linux-gnueabihf
- armv8l-linux-gnueabihf
type: choice
runs:
using: "composite"
steps:
- name: Setup the Environment
shell: bash
run: |
choco install 7zip -y
choco install wget -y
- name: Download and Install Linaro toolchain to PATH
shell: bash
run: |
case "${{ inputs.version }}" in
"7") DATE="2019.12"; VERSION_PART=7.5.0;;
"6") DATE="2018.12"; VERSION_PART=6.5.0;;
"5") DATE="2017.10"; VERSION_PART=5.5.0;;
"4") DATE="2017.01"; VERSION_PART=4.9.4;;
*) echo "Date not found for version ${{ inputs.version }}"; exit 1;;
esac
TOOLCHAIN_LOWER=$(echo ${{ inputs.toolchain }} | tr '[:upper:]' '[:lower:]')
TOOLCHAIN="gcc-linaro-${VERSION_PART}-${DATE}-i686-mingw32_${TOOLCHAIN_LOWER}"
URL="https://releases.linaro.org/components/toolchain/binaries/latest-${{ inputs.version }}/${TOOLCHAIN_LOWER}/${TOOLCHAIN}.tar.xz"
OUTPUT="gcc-linaro"
MAX_RETRIES=5
for i in $(seq 1 $MAX_RETRIES); do
wget "$URL" -O "$OUTPUT.tar.xz"
if [ $? -eq 0 ]; then
echo "Download successful on attempt $i"
break
else
echo "Download failed on attempt $i. Retrying..."
sleep 2
fi
done
if [ $? -ne 0 ]; then
echo "Download from $URL failed after $MAX_RETRIES attempts."
exit 1
fi
7z x $OUTPUT.tar.xz -aoa
7z x $OUTPUT.tar -aoa
mv $TOOLCHAIN $OUTPUT
rm $OUTPUT.tar
rm $OUTPUT.tar.xz
- name: Add GCC Linaro to PATH
shell: bash
run: |
echo "${{ github.workspace }}/gcc-linaro/bin" >> $GITHUB_PATH
echo "CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
echo "CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++" >> $GITHUB_ENV
echo "AR_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar" >> $GITHUB_ENV
branding:
icon: terminal
color: blue