-
Notifications
You must be signed in to change notification settings - Fork 28
95 lines (78 loc) · 2.87 KB
/
publish.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
name: Python Package to conda/arpes
on:
#push: # you can uncomment these if you need to debug the publish process
# branches:
# - master
# - main
release:
types: [published]
jobs:
deploy-conda:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Get conda package dir
id: conda-cache
run: |
echo "::set-output name=dir::$(conda info --json | python -c "import sys, json; print(json.load(sys.stdin)['pkgs_dirs'][0])")"
- name: Cache conda and PyPI modules
uses: actions/cache@v2
env:
cache-name: cache-conda-and-pypi
with:
path: |
${{ steps.pip-cache.outputs.dir }}
${{ steps.conda-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name}}-${{ hashFiles('**/environment*.yml') }}
restore-keys: |
${{ runner.os }}-conda
- name: Install dependencies
run: |
conda env create --quiet --file environment.yml
- name: Run tests
run: |
source activate arpes
conda env update --file environment-update-test.yml
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
python -m pytest -c pytest-config/pytest.ini
- name: Install build requirements
run: |
conda install -y conda-build anaconda-client
pip install setuptools setuptools-scm wheel twine check-manifest
- name: Build wheels
run: |
git clean -xdf
git restore -SW .
python -m build --sdist --wheel .
- name: Check pip artifacts
run: |
python -m twine check dist/*
- name: Conda build
run: |
mkdir "conda-dist"
conda-build ./conda/ -c anaconda -c conda-forge --output-folder conda-dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
- name: Publish package to Conda
run: |
yes | anaconda login --username ${{ secrets.CONDA_USER }} --password ${{ secrets.CONDA_PASSWORD }}
anaconda upload -u arpes conda-dist/noarch/$(ls conda-dist/noarch/ | grep ".tar.bz2")