Skip to content

Commit 9486d13

Browse files
authored
Merge pull request #955 from fpistm/action_update
[CI] Follow best practices in action scripts
2 parents 684c3e8 + 6958c56 commit 9486d13

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.github/actions/pio-build/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ ENV LANG C.UTF-8
55
ENV LC_ALL C.UTF-8
66

77
# Install prerequisites
8-
RUN apt-get update && apt-get install -y git python3 python3-pip wget
8+
RUN apt-get --quiet=2 update && apt-get install --quiet=2 --assume-yes git python3 python3-pip wget
99

1010
# Install PlatformIO
11-
RUN pip3 install -U platformio
11+
RUN pip3 install --quiet --upgrade platformio
1212
CMD /bin/bash
1313

1414
# Copies your code file from your action repository to the filesystem path `/` of the container
+21-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
22

3-
CMSIS_VERSION=$1
4-
CMSIS_ARCHIVE=CMSIS-${CMSIS_VERSION}.tar.bz2
3+
readonly CMSIS_VERSION="$1"
4+
readonly CMSIS_ARCHIVE="CMSIS-${CMSIS_VERSION}.tar.bz2"
55

66
# Install the development version of ststm32 platform
7-
platformio platform install https://github.com/platformio/platform-ststm32.git
8-
7+
platformio platform install "https://github.com/platformio/platform-ststm32.git" || {
8+
exit 1
9+
}
910
# Prepare framework for CI
10-
python3 -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/ststm32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoststm32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
11-
12-
ln -sf $GITHUB_WORKSPACE $HOME/.platformio/packages/framework-arduinoststm32
11+
python3 -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/ststm32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoststm32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()" || {
12+
exit 1
13+
}
14+
ln --symbolic "$GITHUB_WORKSPACE" "$HOME/.platformio/packages/framework-arduinoststm32" || {
15+
exit 1
16+
}
1317
# Download and unpack CMSIS package
14-
wget https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/CMSIS-$CMSIS_VERSION.tar.bz2
15-
tar -xvjf CMSIS-$CMSIS_VERSION.tar.bz2
16-
cd $GITHUB_WORKSPACE/CI/build/
18+
wget --no-verbose "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/$CMSIS_ARCHIVE" || {
19+
exit 1
20+
}
21+
tar --extract --bzip2 --file="$CMSIS_ARCHIVE" || {
22+
exit 1
23+
}
24+
cd "$GITHUB_WORKSPACE/CI/build/" || {
25+
exit 1
26+
}
1727
python3 platformio-builder.py --board=blackpill_f103c8 --board=remram_v1
1828

1929
exit $?

0 commit comments

Comments
 (0)