Skip to content

Commit 35d9643

Browse files
romainsacchiromainsacchi
authored andcommitted
fix github file
1 parent ee6b67f commit 35d9643

1 file changed

Lines changed: 139 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,142 @@ jobs:
8181
run: coveralls --verbose --service=github
8282
env:
8383
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84-
COVERALLS_REPO_TOKEN: $
84+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS }}
85+
86+
- name: Export secrets for tests
87+
if: always()
88+
run: echo "IAM_FILES_KEY is set for downstream jobs"
89+
env:
90+
IAM_FILES_KEY: ${{ secrets.IAM_FILES_KEY }}
91+
92+
pypi:
93+
name: PyPI publish
94+
runs-on: ubuntu-latest
95+
needs: build
96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
os: [ubuntu-latest]
100+
python-version: ["3.9", "3.10"]
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Setup Python
106+
uses: actions/setup-python@v5
107+
with:
108+
python-version: ${{ matrix.python-version }}
109+
110+
- name: Install build
111+
run: |
112+
python -m pip install --upgrade pip
113+
pip install build
114+
115+
- name: Build sdist and wheel
116+
run: python -m build --sdist --wheel --outdir dist/
117+
118+
# Publish to TestPyPI on pushes to branches (not tags)
119+
- name: Publish to TestPyPI on push
120+
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
121+
uses: pypa/gh-action-pypi-publish@release/v1
122+
with:
123+
repository-url: https://test.pypi.org/legacy/
124+
user: __token__
125+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
126+
skip-existing: true
127+
128+
# Publish to PyPI on tags
129+
- name: Publish to PyPI on tag
130+
if: startsWith(github.ref, 'refs/tags/')
131+
uses: pypa/gh-action-pypi-publish@release/v1
132+
with:
133+
user: __token__
134+
password: ${{ secrets.PYPI_API_TOKEN }}
135+
skip-existing: true
136+
137+
conda:
138+
name: Conda build (${{ matrix.python-version }})
139+
runs-on: ubuntu-latest
140+
needs: build
141+
strategy:
142+
fail-fast: false
143+
matrix:
144+
python-version: ["3.9", "3.10"]
145+
146+
steps:
147+
- uses: actions/checkout@v4
148+
149+
- uses: conda-incubator/setup-miniconda@v3
150+
with:
151+
python-version: ${{ matrix.python-version }}
152+
channels: conda-forge,cmutel,konstantinstadler,haasad,pascallesage,romainsacchi
153+
channel-priority: strict
154+
auto-update-conda: true
155+
activate-environment: test
156+
157+
- name: Conda info
158+
shell: bash -l {0}
159+
run: conda info
160+
161+
- name: Branch name
162+
run: echo "running on branch ${GITHUB_REF##*/}"
163+
164+
- name: Publish to Anaconda if push from non-master branch
165+
if: github.ref != 'refs/heads/master'
166+
shell: bash -l {0}
167+
env:
168+
ANACONDA_TOKEN: ${{ secrets.ANACONDA_CLOUD }}
169+
run: |
170+
PKG_NAME=brightpath
171+
USER=romainsacchi
172+
conda install anaconda-client conda-build conda-verify pytest -y
173+
mkdir -p ~/conda-bld
174+
conda config --set anaconda_upload no
175+
export CONDA_BLD_PATH=~/conda-bld
176+
export VERSION=$(date +%Y.%m.%d)
177+
conda build conda/ --old-build-string
178+
conda-verify $CONDA_BLD_PATH/noarch/$PKG_NAME-$VERSION-py_0.tar.bz2
179+
ls $CONDA_BLD_PATH/noarch/
180+
anaconda -t "$ANACONDA_TOKEN" upload -u "$USER" "$CONDA_BLD_PATH/noarch/$PKG_NAME-$VERSION-py_0.tar.bz2" --force
181+
182+
testconda:
183+
name: Test conda pkg (${{ matrix.python-version }})
184+
runs-on: ubuntu-latest
185+
needs: conda
186+
strategy:
187+
fail-fast: false
188+
matrix:
189+
python-version: ["3.9", "3.10"]
190+
191+
steps:
192+
- uses: actions/checkout@v4
193+
194+
- uses: conda-incubator/setup-miniconda@v3
195+
with:
196+
python-version: ${{ matrix.python-version }}
197+
channels: conda-forge,cmutel,konstantinstadler,haasad,pascallesage,romainsacchi
198+
channel-priority: strict
199+
auto-update-conda: true
200+
activate-environment: test
201+
202+
- name: Pull and test (master)
203+
if: github.ref == 'refs/heads/master'
204+
shell: bash -l {0}
205+
env:
206+
IAM_FILES_KEY: ${{ secrets.IAM_FILES_KEY }}
207+
run: |
208+
conda install -y -c romainsacchi brightpath
209+
conda update -y brightpath
210+
conda install -y pytest bottleneck
211+
pytest -m "not ecoinvent"
212+
213+
- name: Pull and test (non-master)
214+
if: github.ref != 'refs/heads/master'
215+
shell: bash -l {0}
216+
env:
217+
IAM_FILES_KEY: ${{ secrets.IAM_FILES_KEY }}
218+
run: |
219+
conda install -y -c romainsacchi brightpath-dev
220+
conda update -y brightpath-dev
221+
conda install -y pytest bottleneck
222+
pytest -m "not ecoinvent"

0 commit comments

Comments
 (0)