Skip to content

Commit 9f1227f

Browse files
authored
Merge pull request #952 from fpistm/PIO_Action
Add PlatformIO Test to the workflow
2 parents ae59287 + 4af4c4f commit 9f1227f

File tree

6 files changed

+76
-1
lines changed

6 files changed

+76
-1
lines changed

.github/actions/pio-build/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Container image that runs your code
2+
FROM ubuntu:latest
3+
4+
ENV LANG C.UTF-8
5+
ENV LC_ALL C.UTF-8
6+
7+
# Install prerequisites
8+
RUN apt-get update && apt-get install -y git python3 python3-pip wget
9+
10+
# Install PlatformIO
11+
RUN pip3 install -U platformio
12+
CMD /bin/bash
13+
14+
# Copies your code file from your action repository to the filesystem path `/` of the container
15+
COPY entrypoint.sh /entrypoint.sh
16+
17+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
18+
ENTRYPOINT ["/entrypoint.sh"]

.github/actions/pio-build/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PlatformIO build action
2+
3+
This action build thanks PIO.
4+
5+
## Inputs
6+
7+
### `cmsis-version`
8+
9+
The CMSIS version to use. Default `"5.5.1"`.
10+
11+
## Example usage
12+
13+
```yaml
14+
uses: ./.github/actions/pio-build
15+
```

.github/actions/pio-build/action.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# action.yml
2+
name: 'PlatformIO Build'
3+
description: 'Compile using PlatformIO'
4+
inputs:
5+
cmsis-version:
6+
description: 'CMSIS package version to use'
7+
default: '5.5.1'
8+
runs:
9+
using: 'docker'
10+
image: 'Dockerfile'
11+
args:
12+
- ${{ inputs.cmsis-version }}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -x
2+
3+
CMSIS_VERSION=$1
4+
CMSIS_ARCHIVE=CMSIS-${CMSIS_VERSION}.tar.bz2
5+
6+
# Install the development version of ststm32 platform
7+
platformio platform install https://github.com/platformio/platform-ststm32.git
8+
9+
# 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
13+
# 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/
17+
python3 platformio-builder.py --board=blackpill_f103c8 --board=remram_v1
18+
19+
exit $?

.github/workflows/Continuous-Integration.yml

+11
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,14 @@ jobs:
5757
run: |
5858
cat ${{ steps.Compile.outputs.compile-result }}
5959
exit 1
60+
pio_build:
61+
runs-on: ubuntu-latest
62+
name: PlatformIO test
63+
steps:
64+
# First of all, clone the repo using the checkout action.
65+
- name: Checkout
66+
uses: actions/checkout@master
67+
68+
- name: PlatformIO
69+
id: Compile
70+
uses: ./.github/actions/pio-build

CI/build/platformio-builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def main():
3535
if boards is None:
3636
boards = ["nucleo_f401re"]
3737

38-
libs_dir = os.path.join(os.environ["TRAVIS_BUILD_DIR"], "libraries")
38+
libs_dir = os.path.join(os.environ["GITHUB_WORKSPACE"], "libraries")
3939
if any(run_platformio(example, boards) for example in collect_examples(libs_dir)):
4040
sys.exit(1)
4141

0 commit comments

Comments
 (0)