From 9e0f977a4d4dbee51ef357db638b339810863b25 Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Thu, 18 Jan 2024 12:23:37 +1100 Subject: [PATCH] fix: run ci on all branches but only release from master --- .github/workflows/CD.yml | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index d884a8d6..94eb6783 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -1,11 +1,9 @@ on: push: - branches: - - master name: release-please jobs: continuous-integration: - name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }} + name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -24,22 +22,23 @@ jobs: shell: bash -l {0} run: | conda install -c loop3d --file dependencies.txt -y - + - name: Checking formatting of code shell: bash -l {0} run: | - pip install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 map2loop --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 map2loop --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Building and install + pip install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 map2loop --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 map2loop --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Building and install shell: bash -l {0} run: | pip install . release-please: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' steps: - uses: GoogleCloudPlatform/release-please-action@v3 id: release @@ -59,7 +58,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "windows-latest"] # , "macos-latest"] + os: ["ubuntu-latest", "windows-latest"] # , "macos-latest"] python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: conda-incubator/setup-miniconda@v2 @@ -69,41 +68,41 @@ jobs: miniforge-variant: Mambaforge miniforge-version: latest use-mamba: true - + - uses: actions/checkout@v2 - name: update submodules run: | - git submodule update --init --recursive + git submodule update --init --recursive - name: Add msbuild to PATH if: matrix.os == 'windows-latest' - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.0.2 - name: Conda build' env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} shell: bash -l {0} run: | - conda install conda-build - conda install -c loop3d --file dependencies.txt -y - conda build -c loop3d --no-test --python ${{ matrix.python-version }} --output-folder conda conda - conda install anaconda-client -y + conda install conda-build + conda install -c loop3d --file dependencies.txt -y + conda build -c loop3d --no-test --python ${{ matrix.python-version }} --output-folder conda conda + conda install anaconda-client -y - name: upload windows env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} if: matrix.os == 'windows-latest' shell: bash -l {0} run: | - anaconda upload --label main conda/win-64/*.tar.bz2 + anaconda upload --label main conda/win-64/*.tar.bz2 - name: upload linux env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} if: matrix.os == 'ubuntu-latest' shell: bash -l {0} run: | - anaconda upload --label main conda/linux-64/*.tar.bz2 + anaconda upload --label main conda/linux-64/*.tar.bz2 - name: upload macosx env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} if: matrix.os == 'macos-latest' shell: bash -l {0} run: | - anaconda upload --label main conda/osx-64/*.tar.bz2 + anaconda upload --label main conda/osx-64/*.tar.bz2