-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (65 loc) · 2.01 KB
/
python-app.yml
File metadata and controls
77 lines (65 loc) · 2.01 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "devel", "main" ]
tags:
- "v*"
pull_request:
branches: [ "devel", "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
- name: Check code formatting with black
run: |
black --check ./tests ./fluxie
- name: Install the package
run: |
pip install pytest jupyter nbconvert
pip install -e .
- name: Test with pytest
run: |
pytest
- name: Test the example notebooks
run: |
NBEXEC="jupyter nbconvert --to notebook --execute --inplace"
$NBEXEC ./scripts/example_basics.ipynb
$NBEXEC ./scripts/example_ecflux.ipynb
release_pypi:
name: PyPI Build and publish Python distributions (PEP 621, Trusted Publishing)
runs-on: ubuntu-latest
needs: ["build"]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, '-') && contains(github.ref_name, '.')
environment:
name: pypi
url: https://pypi.org/p/fluxie
permissions:
id-token: write # Required for Trusted Publishing
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Build distributions with uv
run: uv build
- name: Publish
run: uv publish --trusted-publishing always