|
1 | 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | 3 |
|
4 | | -name: Python package |
| 4 | +name: Unittests |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
8 | | - branches: [ master ] |
| 8 | + branches: [ main ] |
9 | 9 | pull_request: |
10 | | - branches: [ master ] |
| 10 | + branches: [ main ] |
| 11 | + |
| 12 | +env: |
| 13 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} |
11 | 15 |
|
12 | 16 | jobs: |
13 | 17 | build: |
14 | 18 |
|
15 | 19 | runs-on: ${{ matrix.operating-system }} |
16 | 20 | strategy: |
17 | 21 | matrix: |
18 | | - operating-system: [ubuntu-latest, windows-latest, macos-latest] |
19 | | - python-version: ['3.10'] |
20 | 22 | include: |
21 | | - - operating-system: ubuntu-latest |
22 | | - python-version: 3.8 |
23 | | - - operating-system: ubuntu-latest |
24 | | - python-version: 3.9 |
| 23 | + - operating-system: macos-latest |
| 24 | + python-version: '3.11' |
| 25 | + label: osx-64-py-3-11 |
| 26 | + prefix: /Users/runner/miniconda3/envs/my-env |
| 27 | + |
| 28 | + - operating-system: windows-latest |
| 29 | + python-version: '3.11' |
| 30 | + label: win-64-py-3-11 |
| 31 | + prefix: C:\Miniconda3\envs\my-env |
| 32 | + |
| 33 | + - operating-system: ubuntu-latest |
| 34 | + python-version: '3.11' |
| 35 | + label: linux-64-py-3-11 |
| 36 | + prefix: /usr/share/miniconda3/envs/my-env |
| 37 | + |
| 38 | + - operating-system: ubuntu-latest |
| 39 | + python-version: '3.10' |
| 40 | + label: linux-64-py-3-10 |
| 41 | + prefix: /usr/share/miniconda3/envs/my-env |
| 42 | + |
| 43 | + - operating-system: ubuntu-latest |
| 44 | + python-version: 3.9 |
| 45 | + label: linux-64-py-3-9 |
| 46 | + prefix: /usr/share/miniconda3/envs/my-env |
| 47 | + |
| 48 | + - operating-system: ubuntu-latest |
| 49 | + python-version: 3.8 |
| 50 | + label: linux-64-py-3-8 |
| 51 | + prefix: /usr/share/miniconda3/envs/my-env |
25 | 52 |
|
26 | 53 | steps: |
27 | | - - uses: actions/checkout@v2 |
28 | | - - uses: conda-incubator/setup-miniconda@v2 |
29 | | - with: |
30 | | - python-version: ${{ matrix.python-version }} |
31 | | - mamba-version: "*" |
32 | | - channels: conda-forge |
33 | | - channel-priority: strict |
34 | | - auto-update-conda: true |
35 | | - environment-file: .ci_support/environment.yml |
36 | | - - name: Setup |
37 | | - shell: bash -l {0} |
38 | | - run: | |
39 | | - pip install --no-deps . |
40 | | - - name: Test |
41 | | - shell: bash -l {0} |
42 | | - run: coverage run --omit pysqa/_version.py -m unittest discover tests |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + - name: Setup environment |
| 56 | + run: cp .ci_support/environment.yml environment.yml |
| 57 | + - name: Setup Mambaforge |
| 58 | + uses: conda-incubator/setup-miniconda@v2 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + miniforge-variant: Mambaforge |
| 62 | + channels: conda-forge |
| 63 | + channel-priority: strict |
| 64 | + activate-environment: my-env |
| 65 | + use-mamba: true |
| 66 | + - name: Set cache date and number |
| 67 | + run: | |
| 68 | + echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV |
| 69 | + cat .github/variables/cache_number.env >> $GITHUB_ENV |
| 70 | + - uses: actions/cache@v2 |
| 71 | + with: |
| 72 | + path: ${{ matrix.prefix }} |
| 73 | + key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} |
| 74 | + id: cache |
| 75 | + - name: Update environment |
| 76 | + run: mamba env update -n my-env -f environment.yml |
| 77 | + if: steps.cache.outputs.cache-hit != 'true' |
| 78 | + - name: Setup |
| 79 | + shell: bash -l {0} |
| 80 | + run: | |
| 81 | + pip install --no-deps . |
| 82 | + - name: Test |
| 83 | + shell: bash -l {0} |
| 84 | + run: coverage run --omit pysqa/_version.py -m unittest discover tests |
| 85 | + - name: Coverage |
| 86 | + if: matrix.label == 'linux-64-py-3-10' |
| 87 | + shell: bash -l {0} |
| 88 | + run: | |
| 89 | + coverage combine |
| 90 | + coveralls |
| 91 | + coverage xml |
| 92 | + python-codacy-coverage -r coverage.xml |
0 commit comments