Skip to content

Commit

Permalink
Run unit tests on the Windows Subsystem for Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice committed May 28, 2024
1 parent 9b4a7cd commit 8974c00
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,64 @@ jobs:
name: coverage-reports-unit-${{ matrix.platform }}-${{ matrix.python-version }}
path: ./coverage.xml

unit-tests-wsl:
name: Run unit tests on the Windows Subsystem for Linux
needs: [linting]
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
runs-on: windows-latest
defaults:
run:
shell: wsl-bash {0}
steps:
- uses: Vampire/setup-wsl@v3
with:
distribution: Ubuntu-22.04
- uses: actions/checkout@v4
# - uses: Ubuntu/WSL/.github/actions/wsl-checkout@main #?
- name: Install poetry
run: pip install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install poetry (only on MacOS)
if: runner.os == 'macOS'
run: pip install poetry

- name: Install dependencies
run: poetry install --with=dev

- name: Setup passwordless SSH access to localhost for tests
# Adapted from https://stackoverflow.com/a/60367309/6388696
run: |
ssh-keygen -t ed25519 -f ~/.ssh/testkey -N ''
cat > ~/.ssh/config <<EOF
Host localhost
User $USER
HostName 127.0.0.1
IdentityFile ~/.ssh/testkey
EOF
echo -n 'from="127.0.0.1" ' | cat - ~/.ssh/testkey.pub > ~/.ssh/authorized_keys
chmod og-rw ~
ssh -o 'StrictHostKeyChecking no' localhost id
- name: Test with pytest
run: poetry run pytest --cov=milatools --cov-report=xml --cov-append

- name: Store coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage-reports-unit-WSL-${{ matrix.python-version }}
path: ./coverage.xml


mock-slurm-integration-tests:
name: integration tests with a mock slurm cluster
needs: [unit-tests]
needs: [unit-tests, unit-tests-wsl]
runs-on: ${{ matrix.platform }}

strategy:
Expand Down

0 comments on commit 8974c00

Please sign in to comment.