From 8974c002658e2c68cd37ab7adafa3a3927ce6c70 Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Tue, 28 May 2024 09:51:06 -0400 Subject: [PATCH 1/3] Run unit tests on the Windows Subsystem for Linux Signed-off-by: Fabrice Normandin --- .github/workflows/build.yml | 57 ++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e8b5b4a0..1cf7290a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 < ~/.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: From 1d6bcac48c08d4089bcfe56e3f66d5ccce71e7ef Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Tue, 28 May 2024 10:06:37 -0400 Subject: [PATCH 2/3] Move order of steps with setup-python and poetry Signed-off-by: Fabrice Normandin --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cf7290a..be870c8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,16 +99,13 @@ jobs: 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' + - name: Install poetry run: pip install poetry - name: Install dependencies From 0a46bb8e7e6c18a78987fb2574fdfb9b57751145 Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Tue, 28 May 2024 10:26:54 -0400 Subject: [PATCH 3/3] Remove the `poetry` cache Signed-off-by: Fabrice Normandin --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be870c8e..c7402684 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -103,7 +103,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: 'poetry' - name: Install poetry run: pip install poetry