-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (54 loc) · 1.9 KB
/
build.yml
File metadata and controls
59 lines (54 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.11"]
steps:
# This step comes from GitHub Actions' Python Packaging
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip # Path to the directory containing the Python dependencies
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}-python-${{ matrix.python-version }} # Cache key
# This step comes from https://github.com/pypa/hatch/issues/669
# But we don't use pipx because this is a temporary build environment.
- name: Install hatch
run: |
python -m pip install --upgrade pip
pip install hatch
# `not-random` is defined in pyproject.toml and generates .coverage file
- name: Test
run: |
hatch run test:not-random
hatch run test:coverage-xml
- name: Clean and build
run: |
hatch clean
hatch build
- name: Check that package is installable
run: |
pwd
pip install dist/rain-*.whl
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
files: ./coverage.xml
fail_ci_if_error: true # Should the CI build fail if Codecov runs into an error during upload
verbose: true