Skip to content

Commit

Permalink
Merge pull request #461 from Epistimio/fix-github-actions
Browse files Browse the repository at this point in the history
Rework Githuh Actions into a single workflow
  • Loading branch information
bouthilx authored Nov 9, 2020
2 parents dc140e2 + d719cba commit 5bc6ca0
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 174 deletions.
41 changes: 32 additions & 9 deletions .github/workflows/ci.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: ci
name: build

on: [pull_request]
on:
schedule:
- cron: '44 4 * * *'
pull_request:
branches:
- main
- develop
release:

jobs:
pretest:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
toxenv: [flake8, pylint, doc8, docs]

Expand Down Expand Up @@ -58,7 +64,6 @@ jobs:
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
backward-compatibility:
needs: pretest
runs-on: ubuntu-latest
Expand Down Expand Up @@ -90,11 +95,10 @@ jobs:
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
flags: backward
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
pypi:
needs: [test, backward-compatibility]
runs-on: ubuntu-latest
Expand All @@ -108,16 +112,35 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
- name: Test packaging
run: tox -e packaging
- name: Build
run: tox -e build
- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
conda:
needs: [test, backward-compatibility]
runs-on: ubuntu-latest
env:
ANACONDA_TOKEN: ${{ secrets.anaconda_token }}
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Conda build
run: ./conda/conda_test.sh
- name: Build conda
run: ./conda/ci_build.sh
- name: Publish distribution 📦 to Conda
if: startsWith(github.ref, 'refs/tags')
run: ./conda/upload.sh
114 changes: 0 additions & 114 deletions .github/workflows/stable.yml

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ include src/orion/core/_version.py
include versioneer.py

# Exclude development helpers
exclude .travis.yml
exclude tox.ini
exclude *-requirements.txt
exclude .pylintrc
exclude .flake8
exclude codecov.yml
exclude .mailmap
prune conda/
prune .github/

# Include src, tests, docs
recursive-include docs *.rst *.py *.gitkeep *.png
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Oríon
*****

|pypi| |py_versions| |license| |doi|
|rtfd| |codecov| |travis|
|rtfd| |codecov| |github-actions|

.. |pypi| image:: https://img.shields.io/pypi/v/orion.svg
:target: https://pypi.python.org/pypi/orion
Expand All @@ -29,8 +29,8 @@ Oríon
:target: https://codecov.io/gh/Epistimio/orion
:alt: Codecov Report

.. |travis| image:: https://github.com/Epistimio/orion/workflows/build/badge.svg
:target: https://github.com/Epistimio/orion/actions?query=workflow:"build"
.. |github-actions| image:: https://github.com/Epistimio/orion/workflows/build/badge.svg?branch=master&event=pull_request
:target: https://github.com/Epistimio/orion/actions?query=workflow:build+branch:master+event:schedule
:alt: Github actions tests

Oríon is an asynchronous framework for black-box function optimization.
Expand Down
11 changes: 0 additions & 11 deletions conda/conda_test.sh → conda/ci_build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

set -e
set -x

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
Expand All @@ -21,11 +18,3 @@ conda install conda-build anaconda-client
conda build conda --python 3.6
conda build conda --python 3.7
conda build conda --python 3.8

if [[ -n "${TRAVIS_TAG}" ]]
then
mkdir -p conda-bld/linux-64
cp $HOME/miniconda/conda-bld/linux-64/orion* conda-bld/linux-64/
conda convert --platform all conda-bld/linux-64/orion* --output-dir conda-bld/
anaconda -t $ANACONDA_TOKEN upload conda-bld/**/orion*
fi
11 changes: 0 additions & 11 deletions conda/conda_build.sh

This file was deleted.

8 changes: 8 additions & 0 deletions conda/upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

export PATH="$HOME/miniconda/bin:$PATH"

mkdir -p conda-bld/linux-64
cp $HOME/miniconda/conda-bld/linux-64/orion* conda-bld/linux-64/
conda convert --platform all conda-bld/linux-64/orion* --output-dir conda-bld/
anaconda -t $ANACONDA_TOKEN upload conda-bld/**/orion*
28 changes: 19 additions & 9 deletions docs/src/developer/ci.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
.. _ci:

**********************
Continuous Integration
**********************
.. image:: https://travis-ci.org/epistimio/orion.svg?branch=master
:target: https://travis-ci.org/epistimio/orion
.. image:: https://github.com/Epistimio/orion/workflows/build/badge.svg?branch=master&event=pull_request
:target: https://github.com/Epistimio/orion/actions?query=workflow:build+branch:master+event:schedule
:alt: Github actions tests

.. image:: https://codecov.io/gh/epistimio/orion/branch/master/graphs/badge.svg?branch=master
:target: https://codecov.io/gh/epistimio/orion

We use travis-ci_ and codecov_ for continuous integration and tox_ to automate the process at
We use github-actions_ and codecov_ for continuous integration and tox_ to automate the process at
the repository level.

When a commit is pushed in a pull request, a call to ``$ tox`` is made by
TravisCI which triggers the following chain of events:
When a commit is pushed in a pull request, a github workflow is spawned which
triggers the following chain of events:

#. A test environment is spun up for each version of python tested (defined in ``tox.ini``).
#. Code styles verifications, and quality checks are run (``flake8``, ``pylint``, ``doc8``). The
documentation is also built at this time (``docs``).
#. When code style verifications and documentation built passes, a test environment is spun up for
each version of python tested (defined in ``.github/workflows/build.yml``).
#. The test suite is run completely with coverage, including the dedicated backward
compatibility tests.
#. The structure of the repository is validated by ``check-manifest`` and ``readme_renderer``.
#. The results of the coverage check are reported directly in the pull request.
#. When all code tests passes, the structure of the repository is validated by ``check-manifest``
and ``readme_renderer``, and packaging for PyPi and Conda is tested.

The coverage results show the difference of coverage introduced by the changes. We always aim to
have changes that improve coverage.
Expand All @@ -28,6 +32,12 @@ If a step fails at any point in any environment, the build will be immediately s
failed and reported to the pull request and repository. In such case, the maintainers and
relevant contributors will be alerted.

The workflow described above is also executed daily to detect any break due to change in
dependencies. When releases are made, the workflow is also executed and additionally
publish the release to PyPi_ and Conda_.

.. _codecov: https://codecov.io/
.. _travis-ci: https://travis-ci.com/
.. _github-actions: https://docs.github.com/en/free-pro-team@latest/actions
.. _tox: https://tox.readthedocs.io/en/latest/
.. _PyPI: https://pypi.org/project/orion/
.. _Conda: https://anaconda.org/epistimio/orion
24 changes: 9 additions & 15 deletions docs/src/developer/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,23 @@ time to create the release artifacts and publish the release.
release candidate pull request's for the description. See the `0.1.6
<https://github.com/Epistimio/orion/releases/tag/v0.1.6>`_ version example.
#. Merge the master branch back to develop.
#. Update the backward compability tests by adding the new version.
#. Delete the release candidate branch.
#. Update the backward compability tests by adding the new version in develop branch
and make a pull request on develop.

Publishing the release
======================
Once the release is correctly documented and integrated to the VCS workflow, we can publish it to
the public.

* Publish the GitHub release. The source code archives will be added automatically by GitHub to the
release.
* Publish the new version to PyPI_ by executing ``$ tox -e release`` from the tagged commit on the
master branch.
Once the release is made, the :ref:`ci` will be automatically started by Github. The code will
then be published on PyPI_ and Anaconda_ automatically if the tests passes.

After the release
=================
Once published, it's important to notify our user base and community that a new version exists so
they can update their version or learn about Oríon.
Once published, it's important to notify our user base and community that a new
version exists so they can update their version or learn about Oríon.

* Verify Oríon's Zenodo_ page has been updated to reflect the new release on GitHub_. Zenodo is
configured to automatically create a new version whenever a new release is published on GitHub.
* Verify Oríon's Anaconda_ page contains the new version. Binaries for the new version are uploaded
automatically by TravisCI when the tests pass for the merge commit tagged with the new version on
the master branch .
* Verify Oríon's PyPI_ and Anaconda_ page contains the new version. Binaries for the new version are
uploaded automatically by Github's workflow when the tests pass for the merge commit tagged with
the new version on the master branch .
* Announce the new release on your #orion's slack channel.
* Announce the new release on relevant communication channels (e.g., email, forums, google groups)
* Congratulations, you published a new version of Oríon!
Expand Down
1 change: 0 additions & 1 deletion tests/functional/gradient_descent_algo/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include src/orion/core/_version.py
include versioneer.py

# Exclude development helpers
exclude .travis.yml
exclude tox.ini
exclude *-requirements.txt
exclude .pylintrc
Expand Down

0 comments on commit 5bc6ca0

Please sign in to comment.