Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run unit tests on the Windows Subsystem for Linux #126

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,60 @@ 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: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
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
Loading