From 1663746a1fbc5503211c9af5aaeebe78e2e25656 Mon Sep 17 00:00:00 2001 From: zacharyburnett Date: Tue, 6 Feb 2024 12:38:13 -0500 Subject: [PATCH] build for WSL in separate job --- .github/workflows/build.yaml | 31 +++++++++++++++++++--------- .github/workflows/test.yaml | 39 +++++++++--------------------------- 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 21a9cf5..88a82ce 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,21 +51,16 @@ jobs: build: needs: [ date, version ] strategy: - fail-fast: false matrix: runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] python-version: [ '3.9', '3.10', '3.11' ] + fail-fast: false runs-on: ${{ matrix.runs-on }} name: build (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }}) defaults: run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} + shell: bash -leo pipefail {0} steps: - - if: matrix.runs-on == 'windows-latest' - id: wsl - uses: Vampire/setup-wsl@v2 - - if: matrix.runs-on == 'windows-latest' - run: echo ${{ steps.wsl.outputs.wsl-shell-distribution-wrapper-path }} - uses: actions/checkout@v4 - uses: mamba-org/setup-micromamba@v1 with: @@ -78,8 +73,7 @@ jobs: cache-downloads-key: downloads-${{ needs.date.outputs.date }} cache-environment: true cache-environment-key: environment-${{ needs.date.outputs.date }} - init-shell: >- - ${{ matrix.runs-on != 'windows' && 'bash' || 'wsl-bash' }} + init-shell: bash generate-run-shell: false - run: conda env export --no-build | grep -v "name:" | grep -v "prefix:" - run: pytest -n auto tests/test_import.py @@ -95,3 +89,22 @@ jobs: uses: svenstaro/upload-release-action@v2 with: file: ${{ steps.output.outputs.filename }} + build_wsl: + needs: [ date, version ] + runs-on: windows-latest + name: build (WSL) + defaults: + run: + shell: wsl-bash {0} + steps: + - uses: Vampire/setup-wsl@v2 + with: + additional-packages: curl + - name: install micromamba + run: | + mkdir -p ~/micromamba-bin/ + curl -o ~/micromamba-bin/micromamba https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 + ~/micromamba-bin/micromamba shell --init + - run: micromamba env create --name stenv-wsl --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml + + diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e1ee074..e1c2509 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,6 +15,10 @@ env: PYSYN_CDBS: /tmp/trds LD_LIBRARY_PATH: /usr/local/lib +defaults: + run: + shell: bash -leo pipefail {0} + jobs: build: uses: ./.github/workflows/build.yaml @@ -23,7 +27,7 @@ jobs: strategy: matrix: package: [ acstools, asdf, calcos, ccdproc, costools, synphot, jwst ] - runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] + runs-on: [ ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.9', '3.10', '3.11' ] include: - package: acstools @@ -64,12 +68,7 @@ jobs: fail-fast: false runs-on: ${{ matrix.runs-on }} name: ${{ matrix.package }} (Python ${{ matrix.python-version }}, tox ${{ matrix.default_factors }}${{ matrix.args != '' && ' -- ' || '' }}${{ matrix.args }}, ${{ matrix.runs-on }}) - defaults: - run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} steps: - - if: matrix.runs-on == 'windows-latest' - uses: Vampire/setup-wsl@v2 - uses: actions/checkout@v4 with: path: stenv @@ -122,7 +121,7 @@ jobs: strategy: matrix: package: [ reftools, wfpc2tools ] - runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] + runs-on: [ ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.9', '3.10', '3.11' ] include: #- package: pysynphot @@ -142,12 +141,7 @@ jobs: fail-fast: false runs-on: ${{ matrix.runs-on }} name: ${{ matrix.package }} (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }}) - defaults: - run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} steps: - - if: matrix.runs-on == 'windows' - uses: Vampire/setup-wsl@v2 - uses: actions/checkout@v4 - uses: mamba-org/setup-micromamba@v1 with: @@ -183,7 +177,7 @@ jobs: strategy: matrix: package: [ hstcal ] - runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] + runs-on: [ ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.9', '3.10', '3.11' ] include: #- package: drizzlepac @@ -212,12 +206,7 @@ jobs: fail-fast: false runs-on: ${{ matrix.runs-on }} name: ${{ matrix.package }} (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }}) - defaults: - run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} steps: - - if: matrix.runs-on == 'windows-latest' - uses: Vampire/setup-wsl@v2 - uses: actions/checkout@v4 with: path: stenv @@ -275,7 +264,7 @@ jobs: strategy: matrix: package: [ crds ] - runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] + runs-on: [ ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.9', '3.10', '3.11' ] include: - package: crds @@ -292,12 +281,7 @@ jobs: fail-fast: false runs-on: ${{ matrix.runs-on }} name: ${{ matrix.package }} (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }}) - defaults: - run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} steps: - - if: matrix.runs-on == 'windows-latest' - uses: Vampire/setup-wsl@v2 - uses: actions/checkout@v4 with: path: stenv @@ -343,7 +327,7 @@ jobs: strategy: matrix: package: [ calcos, drizzlepac ] - runs-on: [ ubuntu-latest, macos-latest, macos-14, windows-latest ] + runs-on: [ ubuntu-latest, macos-latest, macos-14 ] python-version: [ '3.9', '3.10', '3.11' ] include: - package: calcos @@ -368,12 +352,7 @@ jobs: fail-fast: false runs-on: ${{ matrix.runs-on }} name: ${{ matrix.package }} (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }}) - defaults: - run: - shell: ${{ matrix.runs-on != 'windows-latest' && 'bash -leo pipefail {0}' || 'wsl-bash {0}' }} steps: - - if: matrix.runs-on == 'windows-latest' - uses: Vampire/setup-wsl@v2 - uses: actions/checkout@v4 with: lfs: true