Skip to content

Commit

Permalink
change gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ktactac-ornl committed Jun 3, 2024
1 parent bf41729 commit 1252f76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 89 deletions.
90 changes: 29 additions & 61 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,47 @@
name: pystog_ci_cd

env:
PYTHON_MAIN_VERSION: "3.10"
name: conda packaging and deployment

on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- 'v*'
branches: [qa, main]
tags: ['v*']

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10"]

linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge

- name: Conda install deps
shell: bash -l {0}
channels: conda-forge,defaults
mamba-version: "*"
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: install additional dependencies
run: |
conda install --file requirements.txt --file requirements-dev.txt
conda install pip
pip install tox-gh-actions
- name: Lint with Tox
if: ${{ matrix.python-version == env.PYTHON_MAIN_VERSION }}
shell: bash -l {0}
echo "installing additional dependencies from environment_development.yml"
- name: build conda package
run: |
tox -e lint
tox -e lint-security
- name: Test with Tox
shell: bash -l {0}
run: tox

- name: Coverage - create and upload report
shell: bash -l {0}
if: ${{ matrix.python-version == env.PYTHON_MAIN_VERSION }}
run: |
tox -e coverage
pip install coverage
bash <(curl -s https://codecov.io/bash)
- name: Build Python package and Upload to PyPi
shell: bash -l {0}
if: false # disabled for now
#if: ${{ startsWith( github.ref, 'refs/tags/v') && matrix.python-version == env.PYTHON_MAIN_VERSION }}
env:
PYPI_TOKEN_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pip install wheel twine
python setup.py sdist bdist_wheel
twine upload --username "__token__" --password $PYPI_TOKEN_PASSWORD dist/*
- name: Build conda package and upload to Anaconda
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --channel conda-forge --output-folder . .
conda verify noarch/pystog*.tar.bz2
- name: upload conda package to anaconda
shell: bash -l {0}
if: ${{ startsWith( github.ref, 'refs/tags/v') && matrix.python-version == env.PYTHON_MAIN_VERSION }}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
conda install -y anaconda-client conda-build conda-verify boa
cd conda.recipe
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
conda mambabuild --output-folder . .
anaconda upload --label $CONDA_LABEL noarch/*.tar.bz2
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/pystog*.tar.bz2
28 changes: 0 additions & 28 deletions tox.ini

This file was deleted.

0 comments on commit 1252f76

Please sign in to comment.