-
Notifications
You must be signed in to change notification settings - Fork 864
142 lines (133 loc) · 4.4 KB
/
release.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Runs the complete test suite incl. many external command line dependencies (like Openbabel)
# as well as the pymatgen.ext package. Coverage is computed based on this workflow.
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
task:
type: choice
options: [tests, release]
default: tests
description: Only run tests or release a new version of pymatgen to PyPI after tests pass.
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
env:
PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }}
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
PMG_TEST_FILES_DIR: ${{ github.workspace }}/tests/files
GULP_LIB: ${{ github.workspace }}/cmd_line/gulp/Libraries
PMG_VASP_PSP_DIR: ${{ github.workspace }}/tests/files
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: setup.py
- name: Copy GULP to bin
if: matrix.os == 'ubuntu-latest'
run: |
sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
- name: Install Bader
if: matrix.os == 'ubuntu-latest'
run: |
wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
tar xvzf bader_lnx_64.tar.gz
sudo mv bader /usr/local/bin/
continue-on-error: true # This is not critical to succeed.
- name: Install Enumlib
if: matrix.os == 'ubuntu-latest'
run: |
git clone --recursive https://github.com/msg-byu/enumlib.git
cd enumlib/symlib/src
export F90=gfortran
make
cd ../../src
make enum.x
sudo mv enum.x /usr/local/bin/
cd ..
sudo cp aux_src/makeStr.py /usr/local/bin/
continue-on-error: true # This is not critical to succeed.
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install numpy cython packaging
python -m pip install -e '.[dev,optional]'
- name: pytest
run: |
rm -rf .coverage* coverage*
pytest --cov=pymatgen tests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
build_sdist:
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.10"
- run: |
python -m pip install build
pip install -e .
- name: Build sdist
run: python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_wheels:
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
needs: test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["39", "310", "311"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
- name: Save artifact
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
release:
needs: [build_wheels, build_sdist]
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
runs-on: ubuntu-latest
permissions:
# For pypi trusted publishing
id-token: write
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Get build artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true