forked from adafruit/tinyuf2
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (83 loc) · 3.66 KB
/
build_util.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
name: Reusable build util
on:
workflow_call:
inputs:
port:
required: true
type: string
boards:
required: true
type: string
build-system:
required: false
type: string
default: 'make'
toolchain:
required: true
type: string
toolchain_version:
required: false
type: string
jobs:
board:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board: ${{ fromJSON(inputs.boards) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Fetch tags
run: git fetch --tags
- name: Setup Toolchain
id: setup-toolchain
uses: ./.github/actions/setup_toolchain
with:
toolchain: ${{ inputs.toolchain }}
toolchain_version: ${{ inputs.toolchain_version }}
- name: Get Dependencies
run: |
python tools/get_deps.py --board ${{ matrix.board }}
echo BIN_PATH=ports/${{ inputs.port }}/_bin/${{ matrix.board }} >> $GITHUB_ENV
- name: Build
if: inputs.toolchain != 'esp-idf'
run: |
make -C ports/${{ inputs.port }} BOARD=${{ matrix.board }} all self-update copy-artifact
if [ -d "ports/${{ inputs.port }}/apps" ]; then
for app in ports/${{ inputs.port }}/apps/*/; do if [ $app != 'apps/self_update/' ]; then make -C $app BOARD=${{ matrix.board }} all; fi done
fi
- name: Build using ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
run: docker run --rm -v $PWD:/project -w /project espressif/idf:${{ inputs.toolchain_version }} /bin/bash -c "git config --global --add safe.directory /project && make -C ports/espressif/ BOARD=${{ matrix.board }} all self-update copy-artifact"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.board }}
path: ${{ env.BIN_PATH }}
- name: Prepare Release Asset
if: github.event_name == 'release'
run: |
if [ ${{ inputs.toolchain }} == 'esp-idf' ]; then
zip -jr tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip ${{ env.BIN_PATH }}
cp ${{ env.BIN_PATH }}/update-tinyuf2.uf2 update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2
else
for f in ${{ env.BIN_PATH }}/*; do mv $f ${f%.*}-${{ github.event.release.tag_name }}."${f#*.}"; done
zip -jr tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip ${{ env.BIN_PATH }}
fi
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
tinyuf2-${{ matrix.board }}-*.zip
${{ env.BIN_PATH }}/update-tinyuf2-${{ matrix.board }}-*.uf2
- name: Upload Release Assets To AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'release' && inputs.port == 'espressif'
run: |
[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip s3://adafruit-circuit-python/bootloaders/esp32/tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip --no-progress --region us-east-1
[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2 s3://adafruit-circuit-python/bootloaders/esp32/update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2 --no-progress --region us-east-1