-
Notifications
You must be signed in to change notification settings - Fork 12
97 lines (90 loc) · 2.99 KB
/
test.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# TODO: add windows-latest build
jobs:
lint-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -e .[test]
- name: Run isort check
run: python -m isort codebleu --check
- name: Run black check
run: python -m black codebleu --check
- name: Run ruff check
run: python -m ruff codebleu
# - name: Run mypy check
# run: python -m mypy codebleu
# First run tests to fail fast, then testing on all python versions and os
fast-tests-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -e .[test]
- name: Run tests
run: python -m pytest
external-build-workflow:
needs: [fast-tests-python]
uses: ./.github/workflows/build.yml
with:
CIBW_SKIP: "pp* cp36-* cp37-*"
CIBW_BUILD: "cp*-macosx* cp*-manylinux*"
secrets: inherit
full-tests-python:
needs: [fast-tests-python, external-build-workflow]
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest]
fail-fast: false
name: Test wheel on ${{ matrix.os }} and Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact # if `name: artifact` is omitted, the action will create extra parent dir
path: dist
- name: Show dist files
run: ls -lah ./dist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
# force install package from local dist directory
# TODO: check the sdist package is not installed
rm -rf ./dist/*.tar.gz
pip install --upgrade --no-deps --no-index --find-links=./dist codebleu
# install dependencies for the package and tests
pip install .[test]
- name: Test itself
run: python -m pytest --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: coverage.xml
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)