-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 5.44 KB
/
main.yml
File metadata and controls
130 lines (113 loc) · 5.44 KB
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
# Workflow that builds ActinicArduino
name: ActinicArduino CI
on:
push:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Run at 13:37 on the 12th of every month (odd time to reduce load)
- cron: '37 13 12 * *'
# Can't use simpler definition of [ push, pull_request, schedule ]
# See https://www.jeffgeerling.com/blog/2020/running-github-actions-workflow-on-schedule-and-other-events
# See https://github.com/arduino/arduino-cli-example/blob/master/.github/workflows/test.yaml
# And https://thecurve.io/production-arduino-binary-builds-with-github-actions/
jobs:
build-avr:
strategy:
fail-fast: false
matrix:
# The matrix will produce one job for each configuration
# parameter of type `arduino-platform`, in this case a
# total of 2.
arduino-platform: ["adafruit:samd", "arduino:avr"]
# This is usually optional but we need to statically define the
# FQBN of the boards we want to test for each platform. In the
# future the CLI might automatically detect and download the core
# needed to compile against a certain FQBN, at that point the
# following `include` section will be useless.
include:
# This works like this: when the platform is "adafruit:samd", the
# variable `fqbn` is set to "adafruit:samd:adafruit_itsybitsy_m4".
- arduino-platform: "adafruit:samd"
fqbn: "adafruit:samd:adafruit_itsybitsy_m4"
- arduino-platform: "arduino:avr"
fqbn: "arduino:avr:uno"
name: Linux
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
- name: Cache Arduino packages
uses: actions/cache@v3
with:
key: ${{ runner.os }}-build-${{ matrix.arduino-platform }}-${{ hashFiles('.github/workflows/main.yml') }}
path: |
~/.arduino15/cache
~/.arduino15/packages
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1
# See https://github.community/t/syntax-for-replacing-characters-in-string/17240/1
# And https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Convert platform variables
run: |
fqbn_filename="${fqbn//:/_}"
echo "Filename-safe FQBN: ${fqbn_filename}"
echo "fqbn_filename=${fqbn_filename}" >> $GITHUB_ENV
env:
fqbn: ${{ matrix.fqbn }}
- name: Configure Arduino CLI
run: |
arduino-cli config init
# Add Adafruit boards
arduino-cli config set board_manager.additional_urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
# Allow "unsafe" library fetching
arduino-cli config set library.enable_unsafe_install true
- name: Print Arduino CLI version
run: arduino-cli version
- name: Manually update index (arduino-cli v0.28 bug)
run: |
# Update package index
# This became necessary after upgrading from arduino-cli v0.27.1 to v0.28.0
arduino-cli core update-index
# We then install the platform, which one will be determined
# dynamically by the build matrix.
- name: Install platform
run: |
arduino-cli core install ${{ matrix.arduino-platform }}
# Not needed: arduino-cli core update
- name: Install libraries
run: |
arduino-cli lib install FastLED
arduino-cli lib install --git-url https://github.com/digitalcircuit/G35ArduinoLibrary.git
#arduino-cli lib install "Adafruit DotStar"
# Switch to the brightness-limited version
# See https://github.com/adafruit/Adafruit_DotStar/pull/26
# Note: dependencies don't seem to be auto-installed when using zip files
arduino-cli lib install "Adafruit BusIO"
wget -N "https://github.com/digitalcircuit/Adafruit_DotStar/archive/refs/heads/ft-hw-limit-brightness.zip"
arduino-cli lib install --zip-path ft-hw-limit-brightness.zip
- name: Upgrade Arduino cache
run: |
arduino-cli upgrade
# Compile
- name: Compile sketch
run: |
arduino-cli board attach -b ${{ matrix.fqbn }} # Tailor build to specific board
arduino-cli compile -b ${{ matrix.fqbn }} --output-dir "${{ github.workspace }}/build-output"
- name: Save build information
run: |
echo "ActinicArduino for ${{ matrix.fqbn }}" >> ${{ github.workspace }}/build-output/build-info.txt
echo "https://github.com/digitalcircuit/ActinicArduino/" >> ${{ github.workspace }}/build-output/build-info.txt
echo "--------" >> ${{ github.workspace }}/build-output/build-info.txt
git describe --always --long >> ${{ github.workspace }}/build-output/build-info.txt
#
echo "Commit hash: ${{ github.sha }}" >> ${{ github.workspace }}/build-output/build-info.txt
echo "Run ID: ${{ github.run_id }}" >> ${{ github.workspace }}/build-output/build-info.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ActinicArduino-${{ env.fqbn_filename }}
path: |
${{ github.workspace }}/build-output/build-info.txt
${{ github.workspace }}/build-output/ActinicArduino.ino.*
if-no-files-found: error # Require an artifact