-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (88 loc) · 3.12 KB
/
Copy pathci.yml
File metadata and controls
103 lines (88 loc) · 3.12 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
# Triggers on pushes to main, dev and tags.
on:
workflow_dispatch:
push:
branches:
- main
- develop
tags:
- '*'
paths:
# Only run test and docker publish if some code have changed
- 'pyproject.toml'
- 'titiler/**'
- '.pre-commit-config.yaml'
- '.github/workflows/ci.yml'
# Run tests on pull requests.
pull_request:
env:
LATEST_PY_VERSION: '3.13'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install uv
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
with:
version: "0.9.*"
enable-cache: false
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv sync
- name: run pre-commit
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
run: |
uv run pre-commit run --all-files
- name: Run tests
run: |
uv run pytest --cov=titiler.eopf --cov-report=xml --cov-append --cov-report=term-missing
- name: Upload Results
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5
with:
file: ./coverage.xml
flags: unittests
name: ${{ matrix.python-version }}
fail_ci_if_error: false
benchmark:
if: github.repository == 'EOPF-Explorer/titiler-eopf'
needs: [tests]
runs-on: ubuntu-latest
permissions:
contents: write # Push benchmark results to gh-benchmarks branch
pull-requests: write # Leave PR comments when benchmark regressions exceed alert threshold
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install uv
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
with:
version: "0.9.*"
enable-cache: false
python-version: ${{ env.LATEST_PY_VERSION }}
- name: Install dependencies
run: |
uv sync --frozen
- name: Run Benchmark
run: |
uv run --frozen --group performance pytest tests/benchmarks/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-sort 'min' --benchmark-json output.json
- name: Store and Compare benchmark result
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1
with:
name: titiler-eopf Benchmarks
tool: 'pytest'
output-file-path: output.json
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: false
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: 'gh-benchmarks'
# Make a commit on `gh-benchmarks` only if main
auto-push: ${{ github.ref == 'refs/heads/main' }}
benchmark-data-dir-path: dev/benchmarks