-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.54 KB
/
tests.yml
File metadata and controls
81 lines (68 loc) · 2.54 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CACHE_NUMBER: 0 # increase to reset cache manually
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-version: latest
activate-environment: grid_pdf-model-dev
use-mamba: true
- name: Cache Conda packages
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci_environment.yml') }}
- name: Update environment
run: |
mamba env update -n grid_pdf-model-dev -f ci_environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
source $(conda info --base)/etc/profile.d/conda.sh # Initialize Conda
conda activate grid_pdf-model-dev
python -m pip install --upgrade pip
- name: Install colibri private repository
run: |
source $(conda info --base)/etc/profile.d/conda.sh # Initialize Conda
conda activate grid_pdf-model-dev
pip install git+https://${{ secrets.GRIDPDF_TOKEN }}@github.com/HEP-PBSP/colibri.git
- name: Lint with flake8
shell: bash -l {0}
run: |
source $(conda info --base)/etc/profile.d/conda.sh # Initialize Conda
conda activate grid_pdf-model-dev
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# shell: bash -l {0}
# run: |
# source $(conda info --base)/etc/profile.d/conda.sh # Initialize Conda
# conda activate grid_pdf-model-dev
# pip install pytest pytest-cov
# pytest -p no:warnings grid_pdf/tests --cov --cov-report=xml
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4.2.0
# with:
# token: ${{ secrets.CODECOV_TOKEN }}