forked from vshymanskyy/TinyGSM
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (132 loc) · 6.29 KB
/
build_examples_platformio.yaml
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
name: Build Examples with PlatformIO
# Triggers the workflow on push or pull request events
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
determine_library_source:
name: determine_library_source
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
outputs:
library_install_zip: ${{ steps.store_vars.outputs.library_install_zip }}
library_install_git: ${{ steps.store_vars.outputs.library_install_git }}
steps:
- uses: actions/checkout@v4
- name: Set environment variables for pushes to any branch
if: github.event_name == 'push'
run: |
echo "Push to commit ${GITHUB_SHA}"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set environment variable for PR's from any branch
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.name == github.repository
run: |
echo "Pull Request from the ${GITHUB_HEAD_REF} branch"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_HEAD_REF}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Set environment variable for PR's from any fork
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.name != github.repository
run: |
echo "Pull Request from the fork ${{ github.event.pull_request.head.repo.full_name }} at ${{ github.event.pull_request.head.ref }}"
echo "LIBRARY_INSTALL_ZIP=https://github.com/${{ github.event.pull_request.head.repo.full_name }}/archive/${{ github.event.pull_request.head.ref }}.zip" >> $GITHUB_ENV
echo "LIBRARY_INSTALL_GIT=https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git#${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
- name: store enviroment variables as output
id: store_vars
run: |
echo "library_install_zip=${{ env.LIBRARY_INSTALL_ZIP }}" >> $GITHUB_OUTPUT
echo "library_install_git=${{ env.LIBRARY_INSTALL_GIT }}" >> $GITHUB_OUTPUT
print_library_source:
name: print_library_source
runs-on: ubuntu-latest
needs: determine_library_source
steps:
- name: Check the library installation source
run: |
echo "Link to zip for Arduino CLI testing install:"
echo "${{ needs.determine_library_source.outputs.library_install_zip }}"
echo
echo "Git reference for PlatformIO testing install"
echo "${{ needs.determine_library_source.outputs.library_install_git }}"
build_pio:
runs-on: ubuntu-latest
needs: [determine_library_source]
env:
LIBRARY_INSTALL_GIT: ${{ needs.determine_library_source.outputs.library_install_git }}
strategy:
matrix:
example:
[
examples/BlynkClient,
examples/FileDownload,
examples/MqttClient,
examples/WebClient,
tools/test_build,
tools/Diagnostics,
]
modem:
[
TINY_GSM_MODEM_A6,
TINY_GSM_MODEM_BG96,
TINY_GSM_MODEM_A7672X,
TINY_GSM_MODEM_ESP8266,
TINY_GSM_MODEM_M95,
TINY_GSM_MODEM_M590,
TINY_GSM_MODEM_MC60,
TINY_GSM_MODEM_SIM800,
TINY_GSM_MODEM_SIM808,
TINY_GSM_MODEM_SIM5360,
TINY_GSM_MODEM_SIM7600,
TINY_GSM_MODEM_SIM7000,
TINY_GSM_MODEM_SIM7000SSL,
TINY_GSM_MODEM_SIM7070,
TINY_GSM_MODEM_UBLOX,
TINY_GSM_MODEM_SARAR4,
TINY_GSM_MODEM_SARAR5,
TINY_GSM_MODEM_XBEE,
TINY_GSM_MODEM_SEQUANS_MONARCH,
]
steps:
- uses: actions/checkout@v4
- name: Set variables
run: |
if [[ -z "${GITHUB_HEAD_REF}" ]]; then
echo "::debug::Push to commit ${GITHUB_SHA}"
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_SHA}" >> $GITHUB_ENV
else
echo "::debug::Pull Request from the ${GITHUB_HEAD_REF} branch"
echo "LIBRARY_INSTALL_SOURCE=https://github.com/${GITHUB_REPOSITORY}.git#${GITHUB_HEAD_REF}" >> $GITHUB_ENV
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
# This should be pulled from cache, if there's not a new version
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Restore or Cache PlatformIO Platforms and Libraries
uses: actions/cache@v4
id: cache_pio
with:
path: ~/.platformio
# if nothing in the example_dependencies.json file has changed, then it will
# be a "cache hit" and we can restore libraries from cache and not
# download them. If it has changed we have to re-download.
key: ${{ hashFiles('./examples/example_dependencies.json') }}
# Install cores and library dependencies for the Arduino CLI, iff no cache
- name: Install the Arduino libraries for PlatformIO
if: steps.cache_pio.outputs.cache-hit != 'true'
run: pio lib --global install 89 415 1202 1286
- name: Run PlatformIO
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
TINYGSM_MODEM_TO_USE: ${{ matrix.modem }}
run: |
echo "${{ env.LIBRARY_INSTALL_GIT }}"
pio pkg install -g --library ${{ env.LIBRARY_INSTALL_GIT }}
sed -i 's/\/\/ #define TINY_GSM_MODEM_SIM800/#define TINY_GSM_MODEM_SIM800/g' ${{ matrix.example }}/*
platformio ci --project-option='build_flags=-D ${{ env.TINYGSM_MODEM_TO_USE }}' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev
pio lib --global uninstall TinyGSM