From ba7888a6de5afa8c148a4a1624802ff3705c5492 Mon Sep 17 00:00:00 2001 From: romainsacchi Date: Fri, 6 Sep 2024 09:53:22 +0200 Subject: [PATCH] Add CI pipeline file --- .github/workflows/main.yml | 192 +++++++++++++++++++++++++++++++++++++ examples/~$0509_v1.xlsx | Bin 165 -> 0 bytes 2 files changed, 192 insertions(+) create mode 100644 .github/workflows/main.yml delete mode 100644 examples/~$0509_v1.xlsx diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..12ecb08 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,192 @@ +name: Github Action + +on: + push: + branches: [main, develop] + paths-ignore: # prevents workflow execution when only these types of files are modified + - "**.md" # wildcards prevent file in any repo dir from trigering workflow + - "**.bib" + - "**.ya?ml" # captures both .yml and .yaml + - "LICENSE" + - ".gitignore" + pull_request: + branches: [main, develop] + types: [opened, reopened] # excludes syncronize to avoid redundant trigger from commits on PRs + paths-ignore: + - "**.md" + - "**.bib" + - "**.ya?ml" + - "LICENSE" + - ".gitignore" + workflow_dispatch: # also allow manual trigger, for testing purposes + +jobs: + clean: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Black formatting + uses: lgeiger/black-action@v1.0.1 + with: + args: "./" + + - name: Run isort + uses: jamescurtin/isort-action@master + with: + configuration: --profile black + + - name: Check for modified files + id: git-check + run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) + + - name: Push changes + if: steps.git-check.outputs.modified == 'true' + run: | + git checkout $GITHUB_HEAD_REF + git commit -am "Black reformating" + git push + + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest, macos-13, ubuntu-20.04, macos-latest, windows-2019 ] + py-version: [ "3.9", "3.10", "3.11", "3.12" ] + + steps: + - uses: actions/checkout@v4 + + # general Python setup + - name: Set up Python ${{ matrix.py-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.py-version }} + + - name: Update pip & install testing pkgs + run: | + python -VV + python -m pip install --upgrade pip setuptools wheel + + # install testing + - name: Install package and test deps + run: | + pip install .[testing] # install the package and the testing deps + + - name: Test with pytest + run: | + pytest + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + + Pypi: + runs-on: ubuntu-latest + needs: build + + strategy: + fail-fast: false + matrix: + os: [ "ubuntu-latest" ] + python-version: ["3.11" ] + + steps: + - uses: actions/checkout@v2 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + + - name: Publish distribution 📦 to PyPI if Release + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + skip-existing: true + + - name: Publish distribution 📦 to Test PyPI if Push + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + + conda: + name: (${{ matrix.python-version }}, ubuntu-latest) + runs-on: ubuntu-latest + needs: build + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.11"] + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python-version }} + channels: conda-forge,cmutel,konstantinstadler,haasad,pascallesage,romainsacchi + allow-softlinks: true + channel-priority: strict + auto-update-conda: true + activate-environment: test + + - name: Conda info + shell: bash -l {0} + run: conda info + + - name: Publish distribution 📦 to Anaconda if Push and if master branch + if: startsWith(github.ref, 'refs/heads/master') + shell: bash -l {0} + + run: | + + PKG_NAME=dopo + USER=romainsacchi + conda install anaconda-client + conda install conda-build + mkdir ~/conda-bld + conda config --set anaconda_upload no + export CONDA_BLD_PATH=~/conda-bld + export VERSION=`date +%Y.%m.%d` + conda build "conda/" --old-build-string + ls $CONDA_BLD_PATH/noarch/ + anaconda -t ${{ secrets.ANACONDA_CLOUD }} upload -u $USER $CONDA_BLD_PATH/noarch/$PKG_NAME-$VERSION-py_0.tar.bz2 --force + + testconda: + name: (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + needs: conda + + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest"] + python-version: ["3.11",] + solver: ["classic"] + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python-version }} + channels: conda-forge,romainsacchi + allow-softlinks: true + auto-update-conda: true + activate-environment: test + conda-solver: ${{ matrix.solver }} + + - name: Pull distribution 📦 from Anaconda and test it if master branch + + run: | + conda install romainsacchi::dopo diff --git a/examples/~$0509_v1.xlsx b/examples/~$0509_v1.xlsx deleted file mode 100644 index ff55ad2509386cdf7303df263b3770bee381cb1d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 165 zcmWe|PAtk-a4X78O-V{EN>43PAPNXDI5Q+N6fxv8C@{DI=}d-Hh7^V*AX&ta4ki_V HGSq?q3Q-lU