1
+ name : CI (build and test)
2
+
3
+ on :
4
+ push :
5
+ branches : ["main"]
6
+ tags :
7
+ - " *"
8
+ pull_request :
9
+ branches : ["main"]
10
+
11
+
12
+ jobs :
13
+ tests :
14
+ strategy :
15
+ matrix :
16
+ os : [ubuntu-22.04, macos-latest]
17
+ python-version : ["3.9", "3.10", "3.11"]
18
+ exclude :
19
+ - os : macos-latest
20
+ python-version : ' 3.9'
21
+ - os : macos-latest
22
+ python-version : ' 3.10'
23
+ name : " Core, Python ${{ matrix.python-version }}, ${{ matrix.os }}"
24
+ runs-on : ${{ matrix.os }}
25
+ timeout-minutes : 30
26
+
27
+ steps :
28
+ - uses : actions/checkout@v4
29
+ with :
30
+ fetch-depth : 1
31
+
32
+ - name : Set up Python ${{ matrix.python-version }}
33
+ uses : actions/setup-python@v5
34
+ with :
35
+ python-version : ${{ matrix.python-version }}
36
+ cache : " pip"
37
+
38
+ - name : Install package
39
+ run : python -m pip install -e .[dev]
40
+
41
+ - name : Install some testing dependencies (hard-coded)
42
+ run : python -m pip install pytest pytest-cov devtools jsonschema requests wget pooch
43
+
44
+ - name : Regenerate the manifest
45
+ run : python src/fractal_helper_tasks/dev/create_manifest.py
46
+
47
+ - name : Cache Pooch folder
48
+ id : cache-pooch-folder
49
+ uses : actions/cache@v3
50
+ with :
51
+ path : ~/.cache/pooch
52
+ key : pooch-cache
53
+
54
+ - name : Check if manifest has changed
55
+ run : |
56
+ if [ -n "$(git diff --exit-code ./src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json)" ]; then
57
+ echo "__FRACTAL_MANIFEST__.json has changed. Please run 'python src/fractal_helper_tasks/dev/create_manifest.py' and commit the changes."
58
+ exit 1
59
+ else
60
+ echo "__FRACTAL_MANIFEST__.json has not changed."
61
+ fi
62
+
63
+ - name : Test tasks with pytest
64
+ run : pytest --color=yes --cov --cov-report=xml --cov-report=term-missing -s --log-cli-level debug
65
+
66
+ - name : Upload coverage reports to Codecov
67
+
68
+ with :
69
+ token : ${{ secrets.CODECOV_TOKEN }}
70
+ slug : jluethi/fractal-helper-tasks
71
+
72
+ deploy :
73
+ name : Deploy
74
+ needs : tests
75
+ if : success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
76
+ runs-on : ubuntu-latest
77
+
78
+ permissions :
79
+ # IMPORTANT: this permission is mandatory for trusted publishing on PyPi
80
+ # see https://docs.pypi.org/trusted-publishers/
81
+ id-token : write
82
+ # This permission allows writing releases
83
+ contents : write
84
+
85
+ steps :
86
+ - uses : actions/checkout@v4
87
+ with :
88
+ fetch-depth : 0
89
+
90
+ - name : 🐍 Set up Python
91
+ uses : actions/setup-python@v5
92
+ with :
93
+ python-version : " 3.x"
94
+
95
+ - name : 👷 Build
96
+ run : |
97
+ python -m pip install build
98
+ python -m build
99
+
100
+ - name : 🚢 Publish to PyPI
101
+ # TODO remove the "if: false" line when the package is ready for pypi release
102
+ if : false
103
+ uses : pypa/gh-action-pypi-publish@release/v1
104
+
105
+ - uses : softprops/action-gh-release@v2
106
+ with :
107
+ generate_release_notes : true
108
+ files : ' ./dist/*'
0 commit comments