-
Notifications
You must be signed in to change notification settings - Fork 115
167 lines (141 loc) · 4.11 KB
/
build.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build/Release OpenEVSE
permissions:
contents: write
on:
workflow_dispatch:
inputs:
v2_ref:
required: true
description: The branch/tag for the v2 UI
default: master
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Dump the environment
run: echo "Environment variables:" && env | sort
- name: Dump the event
run: cat $GITHUB_EVENT_PATH
- name: Dump github.ref_name
run: echo "github.ref_name = '${{ github.ref_name }}'"
build:
name: Build ${{ matrix.env }} with ${{ matrix.gui.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- nodemcu-32s
- espressif_esp-wrover-kit
- espressif_esp-wrover-kit_latest
- adafruit_huzzah32_dev
- adafruit_huzzah32
- adafruit_featheresp32
- openevse_wifi_v1
- olimex_esp32-gateway-old
- olimex_esp32-gateway-e
- olimex_esp32-gateway-f
- olimex_esp32-gateway-e_dev
- olimex_esp32-gateway-f_dev
- olimex_esp32-poe-iso
- heltec_esp32-wifi-lora-v2
gui:
- name: gui-v2
repo: OpenEVSE/openevse-gui-v2
build_flags: ""
ref: ${{ inputs.v2_ref }}
steps:
- uses: ammaraskar/gcc-problem-matcher@master
- uses: actions/checkout@v3
- name: Checkout GUI
uses: actions/checkout@v3
with:
repository: ${{ matrix.gui.repo }}
path: ${{ matrix.gui.name }}
ref: ${{ matrix.gui.ref }}
submodules: recursive
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Set up Node JS
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: |
cd ${{ matrix.gui.name }}
npm install
- name: Build GUI
run: |
cd ${{ matrix.gui.name }}
npm run build
- name: Run PlatformIO
run: pio run -e ${{ matrix.env }}
env:
GUI_NAME: ${{ matrix.gui.name }}
PLATFORMIO_BUILD_FLAGS: ${{ matrix.gui.build_flags }}
- name: Upload output to GitHub
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.env }}.bin
path: .pio/build/${{ matrix.env }}/firmware.bin
release:
name: Upload release assets
runs-on: ubuntu-latest
needs: build
if: github.ref_name == 'master' || startsWith(github.ref_name, 'v')
steps:
- name: Download the built assets
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Rename images to something more sensible
run: |
find artifacts -name 'firmware.bin' | while read -r image; do
dir=$(dirname "${image}")
board=$(basename "${dir}")
echo mv "$image" "$board"
mv "$image" "$board"
done
- name: Upload assets to latest release
if: github.ref_name == 'master'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
prerelease: true
title: Development Build
files: |
*.bin
- name: Upload assets to release
if: startsWith(github.ref_name, 'v')
uses: "softprops/action-gh-release@v1"
with:
prerelease: true
name: "${{ github.ref_name }}"
files: |
*.bin