Skip to content

[CI] Follow best practices in action scripts #955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/pio-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

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

# Install PlatformIO
RUN pip3 install -U platformio
RUN pip3 install --quiet --upgrade platformio
CMD /bin/bash

# Copies your code file from your action repository to the filesystem path `/` of the container
Expand Down
32 changes: 21 additions & 11 deletions .github/actions/pio-build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
#!/bin/bash -x
#!/bin/bash

CMSIS_VERSION=$1
CMSIS_ARCHIVE=CMSIS-${CMSIS_VERSION}.tar.bz2
readonly CMSIS_VERSION="$1"
readonly CMSIS_ARCHIVE="CMSIS-${CMSIS_VERSION}.tar.bz2"

# Install the development version of ststm32 platform
platformio platform install https://github.com/platformio/platform-ststm32.git

platformio platform install "https://github.com/platformio/platform-ststm32.git" || {
exit 1
}
# Prepare framework for CI
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()"

ln -sf $GITHUB_WORKSPACE $HOME/.platformio/packages/framework-arduinoststm32
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()" || {
exit 1
}
ln --symbolic "$GITHUB_WORKSPACE" "$HOME/.platformio/packages/framework-arduinoststm32" || {
exit 1
}
# Download and unpack CMSIS package
wget https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/CMSIS-$CMSIS_VERSION.tar.bz2
tar -xvjf CMSIS-$CMSIS_VERSION.tar.bz2
cd $GITHUB_WORKSPACE/CI/build/
wget --no-verbose "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/$CMSIS_VERSION/$CMSIS_ARCHIVE" || {
exit 1
}
tar --extract --bzip2 --file="$CMSIS_ARCHIVE" || {
exit 1
}
cd "$GITHUB_WORKSPACE/CI/build/" || {
exit 1
}
python3 platformio-builder.py --board=blackpill_f103c8 --board=remram_v1

exit $?