Skip to content

Commit d4bf2a4

Browse files
committed
.github: Use devcontainer to run Salt unit-tests
1 parent 12f97ff commit d4bf2a4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/changed-files.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ unit-tests-storage-operator:
3939
unit-tests-salt:
4040
- salt/**
4141
- tox.ini
42+
- .devcontainer/**
4243

4344
unit-tests-lib-alert-tree:
4445
- tools/lib-alert-tree/**

.github/workflows/pre-merge.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,19 +303,28 @@ jobs:
303303
run: make test
304304

305305
unit_tests_salt:
306-
needs: changed-files
306+
runs-on: ubuntu-latest
307+
needs:
308+
- build-devcontainer
309+
- changed-files
310+
container:
311+
image: ghcr.io/${{ github.repository }}/devcontainer:${{ github.sha }}
312+
# We have to use `root` for the moment
313+
# Sees: https://github.com/actions/checkout/issues/1575
314+
# Could work with a user with 1001 id but not for docker
315+
options: --user root
316+
credentials:
317+
username: ${{ github.repository_owner }}
318+
password: ${{ secrets.GITHUB_TOKEN }}
319+
defaults:
320+
run:
321+
shell: bash
307322
if: needs.changed-files.outputs.unit-tests-salt == 'true'
308-
runs-on: ubuntu-20.04
309323
steps:
310324
- name: Checkout
311325
uses: actions/checkout@v4
312-
- name: Install Python 3.6
313-
uses: actions/setup-python@v5
314-
with:
315-
python-version: "3.6"
316-
- name: Install deps
317-
run: |
318-
pip install tox
326+
- name: Set safe directory (since container is root and not user 1001)
327+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
319328
- name: Run all salt unit tests
320329
run: tox -e unit-tests
321330

0 commit comments

Comments
 (0)