From 5871813e1d604adb87d1ec3c90a867089d8050a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Bo=CC=88ck?= Date: Wed, 26 Jan 2022 19:04:51 +0100 Subject: [PATCH] WIP github actions --- .github/workflows/ci.yml | 92 ---------------------- .github/workflows/python-package-conda.yml | 65 +++++++++++++++ .github/workflows/python-package_conda.yml | 34 -------- 3 files changed, 65 insertions(+), 126 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/python-package-conda.yml delete mode 100644 .github/workflows/python-package_conda.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index af60f14b..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: madmom CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.6", "3.7", "3.8", "3.9"] - - 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 OS dependencies - shell: bash -l {0} - run: | - # get a working ffmpeg - sudo wget -O ffmpeg.tar.gz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz - sudo mkdir ffmpeg - sudo tar xvf ffmpeg.tar.gz -C ffmpeg --strip-components=1 - sudo cp ffmpeg/ffmpeg ffmpeg/ffprobe /usr/bin/ - # install system libraries - sudo apt-get update -yy - sudo apt-get install -yy libfftw3-dev - - - name: Cache conda - uses: actions/cache@v2 - env: - # Increase this value to reset cache if etc/example-environment.yml has not changed - CACHE_NUMBER: 1 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles( matrix.envfile ) }} - - - name: Install Conda env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - add-pip-as-python-dependency: true - auto-activate-base: false - activate-environment: madmom - # channel-priority: ${{ matrix.channel-priority }} - environment-file: environment.yml - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - - - name: Conda info - shell: bash -l {0} - run: | - conda info -a - conda list - -# - name: Install dependencies -# run: | -# # install -# python -m pip install --upgrade pip -# pip install flake8 pytest -# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - - name: Install mamom - shell: bash -l {0} - run: python -m pip install --upgrade-strategy only-if-needed -e .[tests] - - - name: Run pytest - shell: bash -l {0} - run: pytest - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - directory: ./coverage/reports/ - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: true - path_to_write_report: ./coverage/codecov_report.txt - verbose: true diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml new file mode 100644 index 00000000..c850dcc6 --- /dev/null +++ b/.github/workflows/python-package-conda.yml @@ -0,0 +1,65 @@ +name: Python Package using Conda + +on: [push] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install OS dependencies + shell: bash -l {0} + run: | + # get a working ffmpeg + sudo wget -O ffmpeg.tar.gz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz + sudo mkdir ffmpeg + sudo tar xvf ffmpeg.tar.gz -C ffmpeg --strip-components=1 + sudo cp ffmpeg/ffmpeg ffmpeg/ffprobe /usr/bin/ + # install system libraries + sudo apt-get update -yy + sudo apt-get install -yy libfftw3-dev + - name: Cache conda + uses: actions/cache@v2 + env: + # Increase this value to reset cache if etc/example-environment.yml has not changed + CACHE_NUMBER: 1 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles( matrix.envfile ) }} + - name: Install Conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + add-pip-as-python-dependency: true + auto-activate-base: false + activate-environment: madmom + # channel-priority: ${{ matrix.channel-priority }} + environment-file: environment.yml + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + - name: Conda info + shell: bash -l {0} + run: | + conda info -a + conda list + - name: Install madmom + shell: bash -l {0} + run: python -m pip install --upgrade-strategy only-if-needed -e .[tests] +# - name: Lint with flake8 +# run: | +# conda install flake8 +# # stop the build if there are Python syntax errors or undefined names +# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics +# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide +# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + conda install pytest + pytest diff --git a/.github/workflows/python-package_conda.yml b/.github/workflows/python-package_conda.yml deleted file mode 100644 index 73a7201d..00000000 --- a/.github/workflows/python-package_conda.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Python Package using Conda - -on: [push] - -jobs: - build-linux: - runs-on: ubuntu-latest - strategy: - max-parallel: 5 - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Install dependencies - run: | - conda env update --file environment.yml --name base - - name: Lint with flake8 - run: | - conda install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - conda install pytest - pytest