Skip to content

Commit 083486c

Browse files
committed
Clean up dependencies installation symlinks on exit
The code used to install Arduino CLI, platform, and library dependencies does this by creating symlinks in the appropriate locations on the runner. The files the script gathers via clone or download, are stored in a temporary folder that is deleted when the script exits. This means the installation symlink for those files has no possible use after the script finishes. This particular pollution of the runner's environment is resolved by also registering a call to delete on exit as each symlink is created.
1 parent c6c5547 commit 083486c

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.github/workflows/test-integration.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,95 @@ jobs:
114114
report-artifact-name: ${{ steps.report-artifact-name.outputs.report-artifact-name }}
115115

116116

117+
multiple-steps:
118+
name: multiple-steps (${{ matrix.board.source-type }})
119+
runs-on: ubuntu-latest
120+
121+
strategy:
122+
fail-fast: false
123+
124+
matrix:
125+
board:
126+
- source-type: manager
127+
fqbn: arduino:avr:uno
128+
platforms: |
129+
- name: arduino:avr
130+
version: 1.8.3
131+
libraries: |
132+
- name: Servo
133+
version: 1.1.7
134+
- source-type: path
135+
fqbn: arduino:avr:uno
136+
platforms: |
137+
- name: arduino:avr
138+
version: 1.8.3
139+
- source-path: extras/ArduinoCore-avr
140+
name: arduino:avr
141+
libraries: |
142+
- source-path: ./
143+
name: Servo
144+
- source-type: repo
145+
fqbn: arduino:avr:uno
146+
platforms: |
147+
- name: arduino:avr
148+
version: 1.8.3
149+
- source-url: https://github.com/arduino/ArduinoCore-avr.git
150+
name: arduino:avr
151+
version: 1.8.3
152+
libraries: |
153+
- source-url: https://github.com/arduino-libraries/Servo.git
154+
name: Servo
155+
version: 1.1.7
156+
- source-type: archive
157+
fqbn: arduino:avr:uno
158+
platforms: |
159+
- name: arduino:avr
160+
version: 1.8.3
161+
- source-url: https://github.com/arduino/ArduinoCore-avr/archive/refs/tags/1.8.3.zip
162+
name: arduino:avr
163+
libraries: |
164+
- source-url: https://github.com/arduino-libraries/Servo/archive/refs/tags/1.1.7.zip
165+
name: Servo
166+
167+
steps:
168+
- name: Checkout library
169+
uses: actions/checkout@v2
170+
with:
171+
repository: arduino-libraries/Servo
172+
ref: 1.1.7
173+
174+
- name: Checkout platform
175+
if: matrix.board.source-type == 'path'
176+
uses: actions/checkout@v2
177+
with:
178+
repository: arduino/ArduinoCore-avr
179+
ref: 1.8.3
180+
path: extras/ArduinoCore-avr
181+
182+
- name: Checkout local repo
183+
uses: actions/checkout@v2
184+
with:
185+
path: extras/compile-sketches
186+
187+
- name: Run action
188+
# Use action from local path
189+
uses: ./extras/compile-sketches
190+
with:
191+
platforms: ${{ matrix.board.platforms }}
192+
fqbn: ${{ matrix.board.fqbn }}
193+
libraries: ${{ matrix.board.libraries }}
194+
sketch-paths: |
195+
- examples/Sweep
196+
197+
- name: Run action again
198+
uses: ./extras/compile-sketches
199+
with:
200+
platforms: ${{ matrix.board.platforms }}
201+
fqbn: ${{ matrix.board.fqbn }}
202+
libraries: ${{ matrix.board.libraries }}
203+
sketch-paths: |
204+
- examples/Sweep
205+
117206
check-sketches-reports:
118207
needs: all-inputs
119208
runs-on: ubuntu-latest

compilesketches/compilesketches.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import atexit
12
import contextlib
23
import enum
34
import json
@@ -576,6 +577,10 @@ def install_from_path(self, source_path, destination_parent_path, destination_na
576577

577578
destination_path.symlink_to(target=source_path, target_is_directory=source_path.is_dir())
578579

580+
# Remove the symlink on script exit. The source path files added by the script are stored in a temporary folder
581+
# which is deleted on exit, so the symlink will serve no purpose.
582+
atexit.register(destination_path.unlink)
583+
579584
def install_platforms_from_repository(self, platform_list):
580585
"""Install libraries by cloning Git repositories
581586

0 commit comments

Comments
 (0)