Skip to content

Commit fc3cfcb

Browse files
committed
Merge branch 'conda-publish'
2 parents 808d876 + aee2f40 commit fc3cfcb

File tree

6 files changed

+182
-2
lines changed

6 files changed

+182
-2
lines changed

.github/workflows/build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Reusable workflow
2+
# Generates the python packages for the CI pipeline (test) as well as the
3+
# release pipeline.
4+
name: Build Python Packages
5+
on: [workflow_call]
6+
jobs:
7+
conda:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
max-parallel: 5
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: '3.10'
18+
- name: Add conda to system path
19+
run: |
20+
# $CONDA is an environment variable pointing to the root of the miniconda directory
21+
echo $CONDA/bin >> $GITHUB_PATH
22+
- name: Install dependencies
23+
run: |
24+
# Pip dependencies
25+
python -m pip install --upgrade pip
26+
pip install build
27+
# Conda dependencies
28+
conda config --add channels conda-forge
29+
conda install --yes conda-build
30+
conda install --yes --file requirements.txt
31+
- name: Build Conda package
32+
run: |
33+
python setup.py bdist_conda
34+
- name: Copy Conda packages to local dist folder
35+
run: |
36+
mkdir -p dist
37+
cp -r /usr/share/miniconda/conda-bld/linux-64 ./dist
38+
cd dist
39+
conda convert -p osx-64 linux-64/*.tar.bz2
40+
conda convert -p win-64 linux-64/*.tar.bz2
41+
42+
- name: Store the distribution packages
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: conda-dist
46+
path: |
47+
dist/*
48+
49+
pypi:
50+
runs-on: ubuntu-latest
51+
strategy:
52+
max-parallel: 5
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Set up Python 3.10
57+
uses: actions/setup-python@v3
58+
with:
59+
python-version: '3.10'
60+
- name: Install dependencies
61+
run: |
62+
# Pip dependencies
63+
python -m pip install --upgrade pip
64+
pip install build
65+
- name: Build Pip package
66+
run: |
67+
python setup.py sdist
68+
- name: Store the distribution packages
69+
uses: actions/upload-artifact@v3
70+
with:
71+
name: pypi-dist
72+
path: |
73+
dist/*

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Continuous Integration Pipeline
2+
on:
3+
push:
4+
branches: ['*']
5+
6+
jobs:
7+
# Build packages
8+
build:
9+
uses: ./.github/workflows/build.yml
10+
11+
# Run tests
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
max-parallel: 5
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: '3.10'
23+
- name: Install test dependencies
24+
run: |
25+
# Pip dependencies
26+
python -m pip install --upgrade pip
27+
pip install -r requirements-dev.txt
28+
pip install flake8
29+
- name: Lint with flake8
30+
run: |
31+
# stop the build if there are Python syntax errors or undefined names
32+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
- name: Test with pytest
36+
env:
37+
RP_API_KEY: ${{ secrets.RP_API_KEY }}
38+
run: |
39+
pytest

.github/workflows/deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Deploy packages to PyPI and Anaconda
2+
on:
3+
release:
4+
types: [released]
5+
jobs:
6+
# Build packages
7+
build:
8+
uses: ./.github/workflows/build.yml
9+
10+
# Anaconda
11+
deploy-conda:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
max-parallel: 1
15+
needs:
16+
- build
17+
steps:
18+
- name: Download the conda dists
19+
uses: actions/download-artifact@v3
20+
with:
21+
name: conda-dist
22+
path: dist/
23+
- name: Set up Python 3.10 for Anaconda
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: '3.10'
27+
- name: Setup anaconda
28+
run: |
29+
# $CONDA is an environment variable pointing to the root of the miniconda directory
30+
echo $CONDA/bin >> $GITHUB_PATH
31+
conda install --yes anaconda-client
32+
- name: Upload to Anaconda
33+
env:
34+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
35+
run: |
36+
ls
37+
cd dist
38+
ls
39+
anaconda upload --label main osx-64/*.tar.bz2
40+
anaconda upload --label main linux-64/*.tar.bz2
41+
anaconda upload --label main win-64/*.tar.bz2
42+
43+
# Pypi
44+
deploy-pypi:
45+
environment:
46+
name: pypi
47+
url: https://pypi.org/p/ravenpackapi
48+
permissions:
49+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
50+
51+
runs-on: ubuntu-latest
52+
strategy:
53+
max-parallel: 1
54+
needs:
55+
- build
56+
steps:
57+
- name: Download the pypi dists
58+
uses: actions/download-artifact@v3
59+
with:
60+
name: pypi-dist
61+
path: dist/
62+
- name: Publish package distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
repository-url: https://pypi.org/legacy/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
/*.sh
88
/dist
99
/build
10-
/.*/

conda/conda_build_config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
python:
2+
- 2.7
3+
- 3.6
4+
- 3.7

ravenpackapi/tests/test_entity_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_mapping_example(self):
4343
mapping = self.api.get_entity_mapping(universe)
4444
assert len(mapping.matched) == 4
4545
assert [m.name for m in mapping.matched] == [
46-
"RavenPack International S.L.",
46+
"RavenPack Holding AG",
4747
"Apple Inc.",
4848
"State of California, US",
4949
"Amazon.com Inc."

0 commit comments

Comments
 (0)