-
Notifications
You must be signed in to change notification settings - Fork 3
128 lines (121 loc) · 4 KB
/
test_and_package.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
name: Test and package distribution
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
workflow_call:
concurrency:
group: test-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
cancel-in-progress: true
# For now always take the "reduced" form of the version, even for those
# actions runs that do not push to a package index.
env:
VERSIONINGIT_FOR_PACKAGE_INDEX: true
permissions: {}
jobs:
run-tests:
name: Test and package on ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
defaults:
run:
shell: "bash -l {0}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
# so versioningit can figure out the version
fetch-depth: 0
fetch-tags: true
- name: Set up Python ${{ matrix.python-version }} with conda
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3
with:
activate-environment: test
auto-activate-base: false
auto-update-conda: true
environment-file: devtools/conda-envs/test_env.yaml
miniforge-version: latest
python-version: ${{ matrix.python-version }}
show-channel-urls: true
- name: Print Python environment
run: python -m pip list
- name: Update installation infrastructure
run: python -m pip install -U setuptools pip
- name: Print conda environment
run: conda list
- name: Print conda info
run: conda info
- name: Print conda config
run: conda config --show
- name: Install
run: python -m pip install .
- name: Run tests
run: make test
- name: Build documentation
run: |
cd docs
make html
- name: GitHub Pages deploy
uses: JamesIves/github-pages-deploy-action@15de0f09300eea763baee31dff6c6184995c5f6a # v4.7.2
with:
branch: gh-pages
folder: docs/build/html
if: ${{ github.event_name == 'push' && matrix.python-version == '3.11' }}
- name: Install pypa/build and pypa/twine
run: |
python -m pip install build twine
- name: Build distribution packages (binary wheel and source tarball)
run: |
python -m build
- name: Check packages with twine
run: |
python -m twine check ./dist/*
- name: Store the distribution packages
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: python-package-distributions-${{ matrix.python-version }}
path: ./dist
check-installation:
name: Check ${{ matrix.install-method }} installation of ${{ matrix.python-version }}
needs:
- run-tests
runs-on: ubuntu-latest
strategy:
matrix:
install-method: [wheel, source]
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
steps:
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: ${{ matrix.python-version }}
- name: Download the distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: python-package-distributions-${{ matrix.python-version }}
path: ./dist
- name: Update environment
run: |
python -m pip install -U setuptools pip
- name: Install from wheel
run: |
python -m pip install ./dist/*.whl
if: matrix.install-method == 'wheel'
- name: Install from source
run: |
python -m pip install ./dist/*.tar.gz
if: matrix.install-method == 'source'
- name: Smoke test
run: |
python -c 'import pymolresponse; print(pymolresponse.__version__)'