-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig.yml
188 lines (184 loc) · 8.06 KB
/
config.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
version: 2.1
orbs:
slack: circleci/[email protected]
win: circleci/[email protected]
parameters:
src-repo-url:
type: string
default: https://github.com/AEFeinstein/Super-2023-Swadge-FW.git
windows-emu-artifact:
type: string
default: swadge-32-windows.zip
firmware-artifact:
type: string
default: swadge-32-firmware.zip
jobs:
build-windows:
executor:
name: win/default
size: large
shell: powershell.exe
parameters:
label:
type: string
default: swadge-32-windows
steps:
- run:
name: Download and setup MSYS2
command: |
# Download installer, but without a progress bar
$ProgressPreference = 'SilentlyContinue'
echo "Started download at $(Get-Date)"
Invoke-WebRequest -Uri https://github.com/msys2/msys2-installer/releases/download/2022-12-16/msys2-base-x86_64-20221216.sfx.exe -Outfile msys2.exe
echo "Finished download at $(Get-Date)"
# Extract to C:\msys64
.\msys2.exe -y -oC:\
# Delete the installer
Remove-Item .\msys2.exe
# Run for the first time
C:\msys64\usr\bin\bash -lc ' '
# Update MSYS2
C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update (in case any core packages are outdated)
C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update
# Install packages
C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -S base-devel mingw-w64-x86_64-toolchain git make zip mingw-w64-x86_64-python-pip python-pip'
- run:
name: Download and setup ESP-IDF
command: |
# Set the path to find msys2 binaries
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
# Clone the IDF
cd ~
mkdir esp
cd esp
git clone -b v4.4.3 --recursive https://github.com/espressif/esp-idf.git esp-idf -j (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
cd esp-idf
# Update submodules
git submodule update --init --recursive -j (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
# Install the tools
.\install.ps1
- run:
name: Clone Swadge Repo and write a version file
shell: powershell.exe
command: |
# Clone out the repository
cd ~\project\
git clone << pipeline.parameters.src-repo-url >> --recurse-submodules -j (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
cd ~\project\Super-2023-Swadge-FW
# Generate a file with the date and version. This will be used for the firmware zip too
echo $(date) >> version.txt
echo "https://github.com/AEFeinstein/Super-2023-Swadge-FW/commit/$env:CIRCLE_SHA1" >> version.txt
- run:
name: Build Swadge Emulator
shell: powershell.exe
command: |
$erroractionpreference = 'stop'
cd ~\project\Super-2023-Swadge-FW
# Set the path to find msys2 binaries
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
# Build the emulator
make -f emu.mk all -j (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
# Make sure it exists
$file = "swadge_emulator.exe"
$CheckFile = Test-Path -Path $file
if (!($CheckFile)) {exit 1 }
# zip everything up and move it to where circleci expects
zip << pipeline.parameters.windows-emu-artifact >> -r swadge_emulator.exe spiffs_image version.txt
zip << pipeline.parameters.windows-emu-artifact >> -j "C:\msys64\mingw64\bin\libwinpthread-1.dll"
cp << pipeline.parameters.windows-emu-artifact >> C:\Users\circleci\project\
- run:
name: Build Swadge Firmware
shell: powershell.exe
command: |
$erroractionpreference = 'stop'
cd ~\project\Super-2023-Swadge-FW
# Set the path to find msys2 binaries
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
# Export the IDF symbols
~\esp\esp-idf\export.ps1
# Build the firmware
idf.py all build dfu
# Make sure it exists
$file = "build\swadge-esp32.bin"
$CheckFile = Test-Path -Path $file
if (!($CheckFile)) {exit 1 }
# zip everything up and move it to where circleci expects
zip << pipeline.parameters.firmware-artifact >> -j build\swadge-esp32.elf build\bootloader\bootloader.bin build\partition_table\partition-table.bin build\swadge-esp32.bin build\storage.bin build\dfu.bin version.txt .\pyFlashGui\pyFlashGui.py
# Move the zips to where circleci expects it so that it gets uploaded as an artifact
cp << pipeline.parameters.firmware-artifact >> C:\Users\circleci\project\
- store_artifacts:
path: << pipeline.parameters.windows-emu-artifact >>
- store_artifacts:
path: << pipeline.parameters.firmware-artifact >>
## Slack orb just doesn't work on Windows...
# notify:
# docker:
# - image: cimg/base:stable
# resource_class: small
# steps:
# - checkout
# - run:
# name: Trick the Slack orb into reporting the status of the most recently finished preceding build job.
# command: source .circleci/trickSlackOrb.sh
# environment:
# VCS_TYPE: << pipeline.project.type >>
# - slack/notify:
# event: pass
# custom: |
# {
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "Fresh hot builds!"
# }
# },
# {
# "type": "divider"
# },
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": ":esp8266-icon: ESP Build\nhttps://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/${CIRCLE_NODE_INDEX}/<< pipeline.parameters.firmware-artifact >>"
# }
# },
# {
# "type": "divider"
# },
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": ":windows95: Windows Build\nhttps://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/${CIRCLE_NODE_INDEX}/<< pipeline.parameters.windows-emu-artifact >>"
# }
# }
# ]
# }
workflows:
version: 2
build-firmware-windows:
jobs:
- build-windows:
filters:
branches:
only: main
## Slack orb just doesn't work on Windows...
# Take advantage of the fact that free CircleCI accounts are limited to
# running one workflow at a time. If you are on a paid account, these
# workflows will instead run in parallel. Consider submitting a pull request
# to the Slack orb to use the bash.exe shell on Windows, using
# https://github.com/eddiewebb/circleci-queue, or using the CircleCI API to
# wait for the build workflow to complete.
# notify:
# jobs:
# - notify:
# context:
# # a context that defines the CIRCLE_TOKEN environment variable
# # to be a CircleCI API token for your project with Admin scope
# - circleci-api-admin
# # a context that defines the SLACK_ACCESS_TOKEN and SLACK_DEFAULT_CHANNEL
# # environment variables as specified by
# # https://github.com/CircleCI-Public/slack-orb#readme
# - slack