-
Notifications
You must be signed in to change notification settings - Fork 164
109 lines (104 loc) · 3.95 KB
/
test-OSW.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
name: Build OSW-OS (Ubuntu, all models)
on:
workflow_dispatch:
push:
paths-ignore: ["*.md", "**/scripts/screen_capture/**"]
pull_request:
branches: [master, develop]
jobs:
check_skip:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: "true" # in a PR with two runs (push+merge), the latter will cancel the first and run instead
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true"
Find-packages:
runs-on: ubuntu-latest
needs: check_skip
if: ${{ (needs.check_skip.outputs.should_skip != 'true') || startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout repository and submodules
uses: nschloe/action-cached-lfs-checkout@v1
with:
submodules: recursive
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
i8n:
- 'include/locales/*.h'
- id: get-languages
run: |
if [ "${{ steps.filter.outputs.i8n }}" == "true" -o "${{ github.head_ref == 'master' }}" == "true" -o "${{ github.base_ref == 'master' }}" == "true" -o "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]; then
echo "languages_matrix=$(python3 .github/getWorkflowMatrix.py all_languages)" >> $GITHUB_OUTPUT
else
echo "languages_matrix=$(python3 .github/getWorkflowMatrix.py default_language)" >> $GITHUB_OUTPUT
fi
- id: get-models
run: echo "models_matrix=$(python3 .github/getWorkflowMatrix.py all_models)" >> $GITHUB_OUTPUT
outputs:
languages_matrix: ${{ steps.get-languages.outputs.languages_matrix }}
models_matrix: ${{ steps.get-models.outputs.models_matrix }}
build-OSW:
needs: Find-packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ${{ fromJson(needs.Find-packages.outputs.languages_matrix) }}
model: ${{ fromJson(needs.Find-packages.outputs.models_matrix) }}
build-configuration: [debug, release]
steps:
- name: Checkout repository and submodules
uses: nschloe/action-cached-lfs-checkout@v1
with:
submodules: recursive
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: platformio-${{ runner.os }}
- name: Install swig
run: sudo apt-get update && sudo apt-get -y install swig
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install PlatformIO
run: python -m pip install --upgrade pip && pip install --upgrade platformio
- name: Rename config
run: mv include/config.h.example include/config.h
- name: Compile language ${{ matrix.language }} model ${{ matrix.model }}
run: python3 .github/buildFirmware.py -l "${{ matrix.language }}" -m "${{ matrix.model }}" -b "${{ matrix.build-configuration }}"
- name: Upload firmware artifacts
uses: actions/upload-artifact@v4
with:
name: firmwares-${{ matrix.language }}-${{ matrix.model }}-${{ matrix.build-configuration }}
path: "*.bin"
# do this last step seperately to avoid race conditions with firmware upload
create-release:
runs-on: ubuntu-latest
needs: build-OSW
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: firmwares*
merge-multiple: true
- name: Create release and upload firmware to it
uses: softprops/action-gh-release@v2
with:
files: "*.bin"
draft: true
prerelease: true
generate_release_notes: true