-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (93 loc) · 3.63 KB
/
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
name: package
on:
push:
tags:
- '*'
jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: |
export VERSION=$(grep __version__ statmechcrack/__init__.py | cut -f2 -d '"')
echo "::set-output name=VERSION::${VERSION}"
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel twine
- name: Make tarball
run: python setup.py sdist
- name: Make wheel
run: python setup.py bdist_wheel
- name: Upload to PyPI.org
run: twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
- name: Give upload time before downloading
run: sleep 500s
test-pypi:
needs: [get-version, pypi]
runs-on: ubuntu-latest
steps:
- name: Install and test the package
run: |
python -m pip install --upgrade pip
pip install statmechcrack==${{ needs.get-version.outputs.VERSION }}
python -m statmechcrack.tests
anaconda:
needs: [get-version, pypi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare conda
run: |
rm -rf statmechcrack
conda update conda
conda install anaconda-client conda-build
- name: Create conda recipe from PyPI
run: conda skeleton pypi --noarch-python --version ${{ needs.get-version.outputs.VERSION }} statmechcrack
- name: Edit meta.yml
run: |
sed -i 's@dev_url:@& \"https://github.com/sandialabs/'statmechcrack'\"@' statmechcrack/meta.yaml
sed -i 's@doc_url:@& \"https://'statmechcrack'.readthedocs.io\"@' statmechcrack/meta.yaml
cp LICENSE statmechcrack/LICENSE
sed -i 's@license_file:@& LICENSE@' statmechcrack/meta.yaml
sed -i '/license_file/a \ \ license_url:' statmechcrack/meta.yaml
sed -i 's@license_url:@& \"https://github.com/sandialabs/'statmechcrack'/blob/main/LICENSE\"@' statmechcrack/meta.yaml
sed -i 's@your-github-id-here@mrbuche@' statmechcrack/meta.yaml
sed -i "s@license: BSD@license: BSD-3-Clause@" statmechcrack/meta.yaml
sudo apt install -y pandoc
pandoc -s -o README.md README.rst
sed -e 's/title: //g' -i README.md
sed -i 's/^/ /' README.md
sed -i '/summary/a \ \ description: |' statmechcrack/meta.yaml
sed -i '/doc_url/e cat README.md' statmechcrack/meta.yaml
cat statmechcrack/meta.yaml
- name: Build conda packages
run: conda build --python 3.9 statmechcrack
- name: Upload to Anaconda.org
run: |
PATH="/usr/share/miniconda/bin/:$PATH"
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --user mrbuche --force /usr/share/miniconda/conda-bld/noarch/statmechcrack*.tar.bz2
- name: Give upload time before downloading
run: sleep 500s
test-anaconda:
needs: [get-version, anaconda]
runs-on: ubuntu-latest
steps:
- name: Install the package
run: conda install --channel mrbuche statmechcrack==${{ needs.get-version.outputs.VERSION }}
- name: Test the package
run: |
conda init
conda list
PATH="/usr/share/miniconda/bin/:$PATH"
python -c 'import statmechcrack'
python -m statmechcrack.tests