Skip to content

Commit f629d22

Browse files
committed
.github: Use devcontainer for lib alert tree unit-tests
1 parent e693578 commit f629d22

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

.github/changed-files.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ unit-tests-salt:
4343

4444
unit-tests-lib-alert-tree:
4545
- tools/lib-alert-tree/**
46+
- .devcontainer/**
4647

4748
integration-tests-ui:
4849
- *ui

.github/workflows/pre-merge.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,29 @@ jobs:
329329
run: tox -e unit-tests
330330

331331
unit_tests_lib_alert_tree:
332-
needs: changed-files
333-
if: needs.changed-files.outputs.unit-tests-lib-alert-tree == 'true'
334-
runs-on: ubuntu-20.04
332+
runs-on: ubuntu-latest
333+
needs:
334+
- build-devcontainer
335+
- changed-files
336+
container:
337+
image: ghcr.io/${{ github.repository }}/devcontainer:${{ github.sha }}
338+
# We have to use `root` for the moment
339+
# Sees: https://github.com/actions/checkout/issues/1575
340+
# Could work with a user with 1001 id but not for docker
341+
options: --user root
342+
credentials:
343+
username: ${{ github.repository_owner }}
344+
password: ${{ secrets.GITHUB_TOKEN }}
335345
defaults:
336346
run:
347+
shell: bash
337348
working-directory: "tools/lib-alert-tree"
349+
if: needs.changed-files.outputs.unit-tests-lib-alert-tree == 'true'
338350
steps:
339351
- name: Checkout
340352
uses: actions/checkout@v4
341-
- name: Install Python 3
342-
uses: actions/setup-python@v5
343-
with:
344-
python-version: "3.6"
345-
- name: Install deps
346-
run: python3.6 -m pip install poetry~=1.1.9
353+
- name: Set safe directory (since container is root and not user 1001)
354+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
347355
- name: Install lib_alert_tree
348356
run: poetry install -E cli
349357
- name: Run all lib_alert_tree unit tests

0 commit comments

Comments
 (0)