👷 setup Github actions

This commit is contained in:
Félix Voituret
2020-07-08 14:59:50 +02:00
parent 6e8f4701b2
commit afce3b95f1
4 changed files with 128 additions and 2 deletions

78
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,78 @@
name: docker
on:
- workflow_dispatch
jobs:
build-test-push:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [cpu, gpu]
distribution: [3.6, 3.7, conda]
model: [modelless, 2stems, 4stems, 5stems]
fail-fast: true
steps:
- uses: actions/checkout@v2
# ----------------------------------------------------------------------
# Note: base image building and env setup.
- name: Setup Python distribution
run: |
echo "::set-env name=base::python:${{ matrix.distribution }}"
echo "::set-env name=tag::${{ matrix.distribution }}"
echo "::set-env name=file::spleeter"
- if: ${{ matrix.distribution }} == 'conda'
name: Build Conda base image
run: |
docker build -t python:conda -f docker/conda.dockerfile .
echo "::set-env name=file::spleeter-conda"
- if: ${{ matrix.platform }} == 'gpu'
name: Build CUDA base image
run: |
docker build \
--build-arg BASE=python:${{ matrix.distribution }}
-t cuda:${{ matrix.distribution }} \
-f docker/cuda-10-0.dockerfile .
echo "::set-env name=base::cuda:${{ matrix.distribution }}"
echo "::set-env name=tag::${{ matrix.distribution }}-gpu"
# ----------------------------------------------------------------------
# Note: image building.
- name: Build researchdeezer/spleeter:${{ env.tag }} image
run: |
docker build \
--build-arg BASE=${{ env.base }} \
-t researchdeezer/spleeter:${{ env.tag }} \
-f docker/${{ env.file }}.dockerfile .
echo "::set-env name=modelargs::"
- if: ${{ matrix.model }} != 'modelless'
name: Build researchdeezer/spleeter:${{ env.tag }}-${{ matrix.model }} image
run: |
docker build \
--build-arg BASE=researchdeezer/spleeter:${{ env.tag }} \
--build-arg MODEL=${{ matrix.model }} \
-t researchdeezer/spleeter:${{ env.tag }}-${{ matrix.model }} \
-f docker/spleeter-model.dockerfile .
echo "::set-env name=tag::${{ env.tag }}-${{ matrix.model }}"
echo "::set-env name=modelarg::-p spleeter:${{ matrix.model }}"
# ----------------------------------------------------------------------
# Note: image testing.
- name: Test researchdeezer/spleeter:${{ env.tag }} image
run: |
docker run \
-v $(pwd):/runtime \
researchdeezer/spleeter:${{ env.tag }} \
separate -i /runtime/audio_example.mp3 -o /tmp \${{ env.modelarg }}
# ----------------------------------------------------------------------
# Note: image deploy.
- name: Docker login
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push researchdeezer/spleeter:${{ env.tag }} image
run: docker push researchdeezer/spleeter:${{ env.tag }}
- if: ${{ env.tag }} == 'spleeter:3.7'
name: Push researchdeezer/spleeter:latest image
run: |
docker tag researchdeezer/spleeter:3.7 researchdeezer/spleeter:latest
docker push researchdeezer/spleeter:latest
- if: ${{ env.tag }} == 'spleeter:3.7-gpu'
name: Push researchdeezer/spleeter:gpu image
run: |
docker tag researchdeezer/spleeter:3.7-gpu researchdeezer/spleeter:gpu
docker push researchdeezer/spleeter:gpu

27
.github/workflows/pypi.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: pypi
on:
pull_request:
types:
- closed
branches:
- master
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
jobs:
deploy-cpu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Package sdist
run: make build
- name: Deploy to pypi
run: make deploy
deploy-gpu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Package sdist
run: make build-gpu
- name: Deploy to pypi
run: make deploy

23
.github/workflows/pytest.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: pytest
on:
- push
- pull_request
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
apt-get update && apt-get install -y ffmpeg
pip install pytest==5.4.3 pytest-xdist==1.32.0 pytest-forked==1.1.3 musdb museval
python setup.py install
- name: Test with pytest
run: make test