|
1 | | -name: CI |
| 1 | +name: CLARITE CI (Python + R) |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - master |
| 5 | + branches: [master] |
7 | 6 | pull_request: |
8 | | - branches: |
9 | | - - master |
| 7 | + branches: [master] |
10 | 8 |
|
11 | 9 | jobs: |
12 | | - |
13 | | - CI_Pipeline: |
| 10 | + test: |
14 | 11 | runs-on: ubuntu-latest |
15 | 12 |
|
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python-version: ["3.10", "3.11", "3.12"] |
| 16 | + |
16 | 17 | env: |
17 | 18 | R_LIBS_USER: ./r-libs |
18 | 19 |
|
19 | 20 | steps: |
20 | | - # - uses: actions/checkout@v1 |
21 | 21 | - uses: actions/checkout@v2 |
22 | | - with: |
23 | | - fetch-depth: 1 |
24 | 22 |
|
25 | | - - name: Make R lib folder if it doesn't exist |
26 | | - run: mkdir -p ${{ env.R_LIBS_USER }} |
27 | | - |
28 | | - - name: Cache R packages |
29 | | - uses: actions/cache@v2 |
30 | | - id: cache-r |
31 | | - with: |
32 | | - path: ${{ env.R_LIBS_USER }} |
33 | | - key: ${{ runner.os }}-renv-${{ hashFiles('**/survey/DESCRIPTION') }} |
34 | | - |
35 | | - - name: Install R packages |
36 | | - shell: Rscript {0} |
37 | | - run: install.packages("survey") |
38 | | - if: steps.cache-r.outputs.cache-hit != 'true' |
| 23 | + - name: Install R and survey package |
| 24 | + run: | |
| 25 | + sudo apt update |
| 26 | + sudo apt install -y r-base |
| 27 | + Rscript -e 'install.packages("survey", repos="https://cloud.r-project.org")' |
39 | 28 |
|
40 | 29 | - name: Set up Python |
41 | 30 | uses: actions/setup-python@v2 |
42 | 31 | with: |
43 | | - # python-version: 3.7 |
44 | | - python-version: '3.9' |
| 32 | + python-version: ${{ matrix.python-version }} |
45 | 33 |
|
46 | 34 | - name: Install Poetry |
47 | | - |
48 | 35 | uses: snok/install-poetry@v1 |
49 | 36 | with: |
50 | 37 | version: 1.5.1 |
51 | 38 | virtualenvs-create: true |
52 | 39 | virtualenvs-in-project: true |
53 | 40 |
|
54 | | - #---------------------------------------------- |
55 | | - # load cached venv if cache exists |
56 | | - #---------------------------------------------- |
57 | 41 | - name: Load cached venv |
58 | 42 | id: cached-poetry-dependencies |
59 | 43 | uses: actions/cache@v2 |
60 | 44 | with: |
61 | 45 | path: .venv |
62 | | - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} |
63 | | - #---------------------------------------------- |
64 | | - # install dependencies if cache does not exist |
65 | | - #---------------------------------------------- |
66 | | - - name: Install dependencies |
| 46 | + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 47 | + |
| 48 | + - name: Install dependencies (if cache miss) |
67 | 49 | if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
68 | 50 | run: poetry install --no-interaction --no-root |
69 | 51 |
|
70 | | - #---------------------------------------------- |
71 | | - # install your root project, if required |
72 | | - #---------------------------------------------- |
73 | 52 | - name: Install library |
74 | 53 | run: poetry install --no-interaction |
75 | 54 |
|
76 | | - #---------------------------------------------- |
77 | | - # Activate Env |
78 | | - #---------------------------------------------- |
79 | | - |
80 | 55 | - name: Code Quality |
81 | 56 | run: | |
82 | 57 | source .venv/bin/activate |
83 | 58 | black . --check |
84 | 59 |
|
85 | 60 | - name: Test with pytest |
86 | | - run: | |
| 61 | + run: | |
87 | 62 | source .venv/bin/activate |
88 | 63 | pytest -n 2 --cov . --cov-report=xml |
89 | 64 |
|
90 | 65 | - name: Upload coverage to Codecov |
91 | | - uses: codecov/codecov-action@v1 |
| 66 | + uses: codecov/codecov-action@v3 |
92 | 67 | with: |
93 | 68 | file: ./coverage.xml |
94 | 69 | flags: unittests |
95 | | - env_vars: OS,PYTHON |
96 | 70 | name: codecov-umbrella |
97 | 71 | fail_ci_if_error: true |
98 | | - path_to_write_report: ./codecov_report.gz |
99 | 72 | verbose: true |
0 commit comments