Skip to content

Commit

Permalink
CI: switch from Gitlab to Github
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Dec 6, 2024
1 parent 996ae49 commit 9a0e3ae
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 118 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Documentation

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10' ]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# DOCS
- name: Install docs requirements
run: pip install -r docs/requirements.txt

- name: Test building documentation
run: python -m sphinx docs/ docs/_build/ -b html -W

- name: Check links in documentation
run: python -m sphinx docs/ docs/_build/ -b linkcheck -W
29 changes: 29 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Linter

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install pre-commit hooks
run: |
pip install pre-commit
pre-commit install --install-hooks
- name: Code style check via pre-commit
run: |
pre-commit run --all-files
87 changes: 87 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build virtualenv
# PyPI package
- name: Build Python package
run: python -m build

- name: Publish Python package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Remove broken apt repos
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
# Documentation
- name: Install doc dependencies
run: |
sudo apt-get install --no-install-recommends --yes libsndfile1 sox
sudo apt-get install --yes graphviz
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Build documentation
run: |
python -m sphinx docs/ docs/_build/ -b html
- name: Deploy documentation to Github pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build

# Github release
- name: Read CHANGELOG
id: changelog
run: |
# Get bullet points from last CHANGELOG entry
CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//')
echo "Got changelog: $CHANGELOG"
# Support for multiline, see
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
{
echo 'body<<EOF'
echo "$CHANGELOG"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create release on Github
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Different platforms
- os: ubuntu-latest
python-version: '3.10'
- os: macOS-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.10'
# Other Python versions
#- os: ubuntu-latest
# python-version: '3.9'
# Other pandas versions

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install tests requirements
run: pip install -r tests/requirements.txt

- name: Test with pytest
run: python -m pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
if: matrix.os == 'ubuntu-latest'
105 changes: 0 additions & 105 deletions .gitlab-ci.yml

This file was deleted.

8 changes: 1 addition & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@
audmodel
========

Library to publish and load models to and from Artifactory_.

.. _Artifactory:
https://artifactory.audeering.com

For documentation see:
http://tools.pp.audeering.com/audmodel/
Library to publish and load machine learning models.
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.. include:: ../README.rst
:end-line: 9

.. toctree::
:caption: Getting started
Expand Down
7 changes: 2 additions & 5 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ Let's define the arguments for our example model:
subgroup = "emotion.cnn"

Per default :mod:`audmodel` uses a repository
on our internal Artifactory_ server,
on our internal Artifactory server,
and you don't have to care about it.
For this example
we don't want to interfere with Artifactory_
we don't want to interfere with Artifactory
and create a local temporary repository
in which the model is stored.

Expand Down Expand Up @@ -334,6 +334,3 @@ the model is placed in a unique sub-folder, namely
:hide-code:

audeer.rmdir("./tmp")


.. _Artifactory: https://artifactory.audeering.com/

0 comments on commit 9a0e3ae

Please sign in to comment.