Skip to content

Commit d2addbe

Browse files
authored
Update github actions workflows
Changes: * Update various actions * Fix pip caching on Windows and MacOS * Separate test, build, and codeql caches * Upload test executable as an artifact * Cache some things for c++ codeql
2 parents 59ba115 + d9dc7ba commit d2addbe

4 files changed

Lines changed: 78 additions & 20 deletions

File tree

.github/workflows/codeql-cpp.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,36 @@ jobs:
3333

3434
steps:
3535
- name: Checkout repository
36-
uses: actions/checkout@v4
36+
id: checkout
37+
uses: actions/checkout@v5
3738

3839
- name: Setup Python
39-
uses: actions/setup-python@v5
40+
id: setup-python
41+
uses: actions/setup-python@v6
4042
with:
4143
python-version: 3.x
4244

45+
- name: Get pip cache dir
46+
id: pip-cache
47+
shell: bash
48+
run: |
49+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
50+
51+
- name: Cache pip packages and Platform IO build cache
52+
uses: actions/cache@v4
53+
with:
54+
path: |
55+
${{ steps.pip-cache.outputs.dir }}
56+
~/.platformio/.cache
57+
key: ubuntu-latest-codeql-${{ matrix.env }}-platformio-${{ hashFiles('platformio.ini') }}
58+
restore-keys: ubuntu-latest-codeql-${{ matrix.env }}-platformio-
59+
4360
- name: Install Platform IO
61+
id: pio-install
4462
run: pip install -U platformio
4563

46-
- name: Create crdential files
64+
- name: Create dummy crdential files
65+
id: create-dummy-creds
4766
run: |
4867
echo "OTA Password" > otapass.txt
4968
echo "WiFi SSID" > wifissid.txt
@@ -52,13 +71,16 @@ jobs:
5271
echo "MQTT Password" > mqttpass.txt
5372
5473
- name: Initialize CodeQL
55-
uses: github/codeql-action/init@v3
74+
id: codeql-init
75+
uses: github/codeql-action/init@v4
5676
with:
5777
languages: ${{ matrix.language }}
5878
queries: security-extended
5979

6080
- name: Build using platformio
81+
id: pio-build
6182
run: pio run -e ${{ matrix.env }}
6283

6384
- name: Perform CodeQL Analysis
64-
uses: github/codeql-action/analyze@v3
85+
id: codeql-analyze
86+
uses: github/codeql-action/analyze@v4

.github/workflows/codeql-js.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ jobs:
3131

3232
steps:
3333
- name: Checkout repository
34-
uses: actions/checkout@v4
34+
id: checkout
35+
uses: actions/checkout@v5
3536

3637
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v3
38+
id: codeql-init
39+
uses: github/codeql-action/init@v4
3840
with:
3941
languages: ${{ matrix.language }}
4042
queries: security-and-quality
4143

4244
- name: Perform CodeQL Analysis
43-
uses: github/codeql-action/analyze@v3
45+
id: codeql-analyze
46+
uses: github/codeql-action/analyze@v4

.github/workflows/pio_build.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,37 @@ jobs:
3030

3131
steps:
3232
- name: Checkout Repo
33-
uses: actions/checkout@v4
33+
id: checkout
34+
uses: actions/checkout@v5
3435

3536
- name: Setup Python
36-
uses: actions/setup-python@v5
37+
id: setup-python
38+
uses: actions/setup-python@v6
3739
with:
3840
python-version: 3.x
3941

42+
- name: Get pip cache dir
43+
id: pip-cache
44+
shell: bash
45+
run: |
46+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
47+
4048
- name: Cache pip packages and Platform IO build cache
4149
uses: actions/cache@v4
4250
with:
4351
path: |
44-
~/.cache/pip
45-
~/.platformio
52+
${{ steps.pip-cache.outputs.dir }}
53+
~/.platformio/.cache
4654
.pio
47-
key: platformio-${{ hashFiles('platformio.ini') }}-${{ matrix.os }}
55+
key: ${{ matrix.os }}-build-platformio-${{ hashFiles('platformio.ini') }}
56+
restore-keys: ${{ matrix.os }}-build-platformio-
4857

4958
- name: Install Platform IO
59+
id: pio-install
5060
run: pip install -U platformio
5161

52-
- name: Create crdential files
62+
- name: Create dummy crdential files
63+
id: create-dummy-creds
5364
run: |
5465
echo "OTA Password" > otapass.txt
5566
echo "WiFi SSID" > wifissid.txt
@@ -58,9 +69,11 @@ jobs:
5869
echo "MQTT Password" > mqttpass.txt
5970
6071
- name: Platform IO build all
72+
id: pio-build-all
6173
if: ${{ matrix.os == 'ubuntu-latest' }}
6274
run: pio run
6375

6476
- name: Platform IO build some
77+
id: pio-build-some
6578
if: ${{ matrix.os != 'ubuntu-latest' }}
6679
run: pio run -e esp32dev -e esp_wroom_02

.github/workflows/pio_test.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow builds all platformio build targets to test whether any of them were broken by a commit.
1+
# This workflow builds and runs the automated tests of this project to test whether any of them were broken by a commit.
22

33
name: Platform IO test
44

@@ -29,24 +29,44 @@ jobs:
2929

3030
steps:
3131
- name: Checkout Repo
32-
uses: actions/checkout@v4
32+
id: checkout
33+
uses: actions/checkout@v5
3334

3435
- name: Setup Python
35-
uses: actions/setup-python@v5
36+
id: setup-python
37+
uses: actions/setup-python@v6
3638
with:
3739
python-version: 3.x
3840

41+
- name: Get pip cache dir
42+
id: pip-cache
43+
shell: bash
44+
run: |
45+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
46+
3947
- name: Cache pip packages and Platform IO build cache
48+
id: cache
4049
uses: actions/cache@v4
4150
with:
4251
path: |
43-
~/.cache/pip
44-
~/.platformio
52+
${{ steps.pip-cache.outputs.dir }}
53+
~/.platformio/.cache
4554
.pio
46-
key: platformio-${{ hashFiles('platformio.ini') }}-${{ matrix.os }}
55+
key: ${{ matrix.os }}-test-platformio-${{ hashFiles('platformio.ini') }}
56+
restore-keys: ${{ matrix.os }}-test-platformio-
4757

4858
- name: Install Platform IO
59+
id: pio-install
4960
run: pip install -U platformio
5061

5162
- name: Platform IO test
63+
id: pio-test
5264
run: pio test -e native
65+
66+
- name: Upload test program
67+
id: upload-artifact
68+
if: ${{ steps.pio-install.conclusion == 'success' }}
69+
uses: actions/upload-artifact@v5
70+
with:
71+
name: ${{ matrix.os }}-test-executable
72+
path: .pio/build/native/program*

0 commit comments

Comments
 (0)