-
Notifications
You must be signed in to change notification settings - Fork 35
100 lines (92 loc) · 3.43 KB
/
build.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
98
99
100
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push:
branches:
- main
- v*.*.*
pull_request:
branches:
- main
- v*.*.*
workflow_dispatch:
jobs:
build:
name: Python ${{ matrix.python-version }}, OS ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast : false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true # default option selected currently
# Load cached environment, if it exists
- name: Load cached poetry environment
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies and root package
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
poetry install --no-interaction
# Install pandoc for building docs
- name: Install pandoc for Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt install pandoc
- name: Install pandoc for Windows
if: matrix.os == 'windows-latest'
run: choco install pandoc --no-progress
- name: Install pandoc for MacOS
if: matrix.os == 'macos-latest'
run: brew install pandoc
- name: Test with pytest
run: |
source $VENV
poetry run pytest --cov=gnss_lib_py/algorithms --cov=gnss_lib_py/navdata --cov=gnss_lib_py/parsers --cov=gnss_lib_py/utils --cov=gnss_lib_py/visualizations --cov-report=xml
- name: Upload coverage report to code-cov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
- name: Test if docs are building
run: |
./build_docs.sh
readme:
runs-on: ubuntu-latest
name: Check if index.rst and README.md weren't changed together
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files since last remote commit
id: changed-files
uses: tj-actions/changed-files@v44
- name: Check if index.rst changed when README.md file changes
if: contains(steps.changed-files.outputs.modified_files, 'README.md') && !contains(steps.changed-files.outputs.modified_files, 'docs/source/index.rst')
run: |
echo "README.md has changed but index.rst has not!"
exit 1
- name: Check if README.md changed when index.rst file changes
if: contains(steps.changed-files.outputs.modified_files, 'docs/source/index.rst') && !contains(steps.changed-files.outputs.modified_files, 'README.md')
run: |
echo "index.rst has changed but README.md has not!"
exit 1