|
1 | 1 | name: Test
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: [main] |
6 |
| - tags: |
7 |
| - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
8 |
| - pull_request: |
9 |
| - branches: [main] |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + tags: |
| 7 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 8 | + pull_request: |
| 9 | + branches: [main] |
10 | 10 |
|
11 | 11 | jobs:
|
12 |
| - test: |
13 |
| - runs-on: ${{ matrix.os }} |
14 |
| - defaults: |
15 |
| - run: |
16 |
| - shell: bash -e {0} # -e to fail on error |
| 12 | + test: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + defaults: |
| 15 | + run: |
| 16 | + shell: bash -e {0} # -e to fail on error |
17 | 17 |
|
18 |
| - strategy: |
19 |
| - fail-fast: false |
20 |
| - matrix: |
21 |
| - python: ["3.9", "3.10"] |
22 |
| - os: [ubuntu-latest] |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + python: ["3.9", "3.10"] |
| 22 | + os: [ubuntu-latest] |
23 | 23 |
|
24 |
| - env: |
25 |
| - OS: ${{ matrix.os }} |
26 |
| - PYTHON: ${{ matrix.python }} |
| 24 | + env: |
| 25 | + OS: ${{ matrix.os }} |
| 26 | + PYTHON: ${{ matrix.python }} |
27 | 27 |
|
28 |
| - steps: |
29 |
| - - uses: actions/checkout@v3 |
30 |
| - - name: Set up Python ${{ matrix.python }} |
31 |
| - uses: actions/setup-python@v3 |
32 |
| - with: |
33 |
| - python-version: ${{ matrix.python }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + - name: Set up Python ${{ matrix.python }} |
| 31 | + uses: actions/setup-python@v3 |
| 32 | + with: |
| 33 | + python-version: ${{ matrix.python }} |
34 | 34 |
|
35 |
| - - name: Get pip cache dir |
36 |
| - id: pip-cache-dir |
37 |
| - run: | |
38 |
| - echo "::set-output name=dir::$(pip cache dir)" |
39 |
| - - name: Restore pip cache |
40 |
| - uses: actions/cache@v3 |
41 |
| - with: |
42 |
| - path: ${{ steps.pip-cache-dir.outputs.dir }} |
43 |
| - key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} |
44 |
| - restore-keys: | |
45 |
| - pip-${{ runner.os }}-${{ env.pythonLocation }}- |
46 |
| - - name: Install test dependencies |
47 |
| - run: | |
48 |
| - python -m pip install --upgrade pip wheel |
49 |
| - pip install pytest-cov |
50 |
| - - name: Install dependencies |
51 |
| - run: | |
52 |
| - pip install -e ".[dev,test]" |
53 |
| - - name: Test |
54 |
| - env: |
55 |
| - MPLBACKEND: agg |
56 |
| - PLATFORM: ${{ matrix.os }} |
57 |
| - DISPLAY: :42 |
58 |
| - run: | |
59 |
| - pytest -v --cov --color=yes --cov-report=xml |
60 |
| - # - name: Generate GH action "groundtruth" figures as artifacts, uncomment if needed |
61 |
| - # if: always() |
62 |
| - # uses: actions/upload-artifact@v3 |
63 |
| - # with: |
64 |
| - # name: groundtruth-figures |
65 |
| - # path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/_images/* |
66 |
| - - name: Archive figures generated during testing |
67 |
| - if: always() |
68 |
| - uses: actions/upload-artifact@v3 |
69 |
| - with: |
70 |
| - name: plotting-results |
71 |
| - path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/figures/* |
72 |
| - - name: Upload coverage to Codecov |
73 |
| - uses: codecov/codecov-action@v3 |
74 |
| - with: |
75 |
| - token: ${{ secrets.CODECOV_TOKEN }} |
76 |
| - fail_ci_if_error: true # optional (default = false) |
77 |
| - verbose: true # optional (default = false) |
78 |
| - deploy: |
79 |
| - # this will run when you have tagged a commit, starting with "v*" |
80 |
| - # and requires that you have put your twine API key in your |
81 |
| - # github secrets (see readme for details) |
82 |
| - needs: [test] |
83 |
| - runs-on: ubuntu-latest |
84 |
| - if: contains(github.ref, 'tags') |
85 |
| - steps: |
86 |
| - - name: Checkout code |
87 |
| - uses: actions/checkout@v3 |
| 35 | + - name: Get pip cache dir |
| 36 | + id: pip-cache-dir |
| 37 | + run: | |
| 38 | + echo "::set-output name=dir::$(pip cache dir)" |
| 39 | + - name: Restore pip cache |
| 40 | + uses: actions/cache@v3 |
| 41 | + with: |
| 42 | + path: ${{ steps.pip-cache-dir.outputs.dir }} |
| 43 | + key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} |
| 44 | + restore-keys: | |
| 45 | + pip-${{ runner.os }}-${{ env.pythonLocation }}- |
| 46 | + - name: Install test dependencies |
| 47 | + run: | |
| 48 | + python -m pip install --upgrade pip wheel |
| 49 | + pip install pytest-cov |
| 50 | + - name: Install dependencies |
| 51 | + run: | |
| 52 | + pip install -e ".[dev,test]" |
| 53 | + - name: Test |
| 54 | + env: |
| 55 | + MPLBACKEND: agg |
| 56 | + PLATFORM: ${{ matrix.os }} |
| 57 | + DISPLAY: :42 |
| 58 | + run: | |
| 59 | + pytest -v --cov --color=yes --cov-report=xml |
| 60 | + # - name: Generate GH action "groundtruth" figures as artifacts, uncomment if needed |
| 61 | + # if: always() |
| 62 | + # uses: actions/upload-artifact@v3 |
| 63 | + # with: |
| 64 | + # name: groundtruth-figures |
| 65 | + # path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/_images/* |
| 66 | + - name: Archive figures generated during testing |
| 67 | + if: always() |
| 68 | + uses: actions/upload-artifact@v3 |
| 69 | + with: |
| 70 | + name: plotting-results |
| 71 | + path: /home/runner/work/spatialdata-plot/spatialdata-plot/tests/figures/* |
| 72 | + - name: Upload coverage to Codecov |
| 73 | + uses: codecov/codecov-action@v3 |
| 74 | + with: |
| 75 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 76 | + fail_ci_if_error: true # optional (default = false) |
| 77 | + verbose: true # optional (default = false) |
| 78 | + deploy: |
| 79 | + # this will run when you have tagged a commit, starting with "v*" |
| 80 | + # and requires that you have put your twine API key in your |
| 81 | + # github secrets (see readme for details) |
| 82 | + needs: [test] |
| 83 | + runs-on: ubuntu-latest |
| 84 | + if: contains(github.ref, 'tags') |
| 85 | + steps: |
| 86 | + - name: Checkout code |
| 87 | + uses: actions/checkout@v3 |
88 | 88 |
|
89 |
| - - name: Set up Python 3.10 |
90 |
| - uses: actions/setup-python@v4 |
91 |
| - with: |
92 |
| - python-version: "3.10" |
| 89 | + - name: Set up Python 3.10 |
| 90 | + uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: "3.10" |
93 | 93 |
|
94 |
| - - name: Install hatch |
95 |
| - run: pip install hatch |
| 94 | + - name: Install hatch |
| 95 | + run: pip install hatch |
96 | 96 |
|
97 |
| - - name: Build project for distribution |
98 |
| - run: hatch build |
| 97 | + - name: Build project for distribution |
| 98 | + run: hatch build |
99 | 99 |
|
100 |
| - - name: Publish a Python distribution to PyPI |
101 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
102 |
| - with: |
103 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
| 100 | + - name: Publish a Python distribution to PyPI |
| 101 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 102 | + with: |
| 103 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments