|
| 1 | +name: Matrix test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash -l {0} |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Python ${{ matrix.python-version }}, OS ${{ matrix.os }} |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + python-version: ['3.10', '3.11', '3.12'] |
| 20 | + os: ["macos-latest", "ubuntu-latest", "windows-latest"] |
| 21 | + steps: |
| 22 | + - name: check out test_workflow |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Initialize miniconda |
| 26 | + uses: conda-incubator/setup-miniconda@v3 |
| 27 | + with: |
| 28 | + activate-environment: test |
| 29 | + auto-update-conda: true |
| 30 | + environment-file: environment.yml |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + auto-activate-base: false |
| 33 | + |
| 34 | + - name: Conda config |
| 35 | + run: >- |
| 36 | + conda config --set always_yes yes |
| 37 | + --set changeps1 no |
| 38 | +
|
| 39 | + - name: Install test_workflow and requirements |
| 40 | + run: | |
| 41 | + conda install --file requirements/run.txt |
| 42 | + conda install --file requirements/test.txt |
| 43 | + python -m pip install -r requirements/pip.txt |
| 44 | + python -m pip install . --no-deps |
| 45 | +
|
| 46 | + - name: Install Xvfb |
| 47 | + if: runner.os == 'Linux' |
| 48 | + run: sudo apt-get install -y xvfb |
| 49 | + |
| 50 | + - name: Start Xvfb |
| 51 | + if: runner.os == 'Linux' |
| 52 | + run: | |
| 53 | + export DISPLAY=:99 |
| 54 | + Xvfb :99 -screen 0 1024x768x16 & |
| 55 | +
|
| 56 | + - name: Validate test_workflow |
| 57 | + run: | |
| 58 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 59 | + export DISPLAY=:99 |
| 60 | + fi |
| 61 | + python -m pytest |
| 62 | +
|
| 63 | + - name: Display Python and Conda info |
| 64 | + run: | |
| 65 | + python --version |
| 66 | + conda info |
0 commit comments