Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: switch to Github #1

Merged
merged 13 commits into from
Jan 17, 2024
73 changes: 73 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Documentation

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

jobs:
build:

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

steps:
- uses: actions/checkout@v3

- name: Cache air
uses: actions/cache@v3
with:
path: ~/audb/air/1.4.2
key: air-1.4.2

- name: Cache cough-speech-sneeze
uses: actions/cache@v3
with:
path: ~/audb/cough-speech-sneeze/2.0.1
key: cough-speech-sneeze-2.0.1

- name: Cache emodb
uses: actions/cache@v3
with:
path: ~/audb/emodb/1.4.1
key: emodb-1.4.1

- name: Cache micirp
uses: actions/cache@v3
with:
path: ~/audb/micirp/1.0.0
key: micirp-1.0.0

- name: Cache musan
uses: actions/cache@v3
with:
path: ~/audb/musan/1.0.0
key: musan-1.0.0

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

- name: Ubuntu - install libsndfile
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --yes libsndfile1 ffmpeg sox libavcodec-extra

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

- 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 ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
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
116 changes: 116 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
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@v3
with:
fetch-depth: 2

- name: Cache air
uses: actions/cache@v3
with:
path: ~/audb/air/1.4.2
key: air-1.4.2

- name: Cache cough-speech-sneeze
uses: actions/cache@v3
with:
path: ~/audb/cough-speech-sneeze/2.0.1
key: cough-speech-sneeze-2.0.1

- name: Cache emodb
uses: actions/cache@v3
with:
path: ~/audb/emodb/1.4.1
key: emodb-1.4.1

- name: Cache micirp
uses: actions/cache@v3
with:
path: ~/audb/micirp/1.0.0
key: micirp-1.0.0

- name: Cache musan
uses: actions/cache@v3
with:
path: ~/audb/musan/1.0.0
key: musan-1.0.0

- name: Set up Python
uses: actions/setup-python@v4
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 ffmpeg sox libavcodec-extra
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@v3
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@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}
62 changes: 62 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test

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

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.10' ]
include:
- os: ubuntu-latest
python-version: '3.11'
tasks: tests
- os: ubuntu-latest
python-version: '3.9'
tasks: tests

steps:
- uses: actions/checkout@v3

- name: Cache emodb
uses: actions/cache@v3
with:
path: ~/audb/emodb/1.4.1
key: emodb-1.4.1

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

- name: Ubuntu - install libsndfile
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --yes libsndfile1 ffmpeg sox libavcodec-extra
if: matrix.os == 'ubuntu-latest'

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

# TESTS
- 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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
if: matrix.os == 'ubuntu-latest'
93 changes: 0 additions & 93 deletions .gitlab-ci.yml

This file was deleted.

Loading