diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4fce4dc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + tags: + - "v*.*.*" + - "test-*" + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11'] + + steps: + - uses: actions/checkout@v3 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Build wheels + uses: pypa/cibuildwheel@v2.14.1 + with: + package-dir: . + output-dir: dist + config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v3 + if: ${{ env.RELEASE_VERSION != ''}} + with: + name: ${{ env.RELEASE_VERSION }}-wheels + retention-days: 15 + path: dist/*.whl + + build_sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + python setup.py sdist + - uses: actions/upload-artifact@v2 + if: ${{ env.RELEASE_VERSION != ''}} + with: + name: ${{ env.RELEASE_VERSION }}-sdist + retention-days: 15 + path: dist/*.tar.gz \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index b5846fc..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,71 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -name: "CodeQL" - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: '0 14 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['python'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c10eecc --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: Deploy + +on: + release: + types: [created] + workflow_dispatch: + +jobs: + + retrieve_artifacts: + runs-on: ubuntu-latest + steps: + - name: Retrieve wheel artifacts for release + uses: actions/download-artifact@v3 + with: + name: ${{ github.event.release.name }}-wheels + path: dist/*.whl + - name: Retrieve SDIST artifacts for release + uses: actions/download-artifact@v3 + with: + name: ${{ github.event.release.name }}-sdist + path: dist/*.tar.gz + + deploy: + needs: retrieve_artifacts + runs-on: ubuntu-latest + steps: + - name: Release code as new release on Pypi + if: ${{ startsWith(github.event.release.name,'v') }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + repository-url: https://PREVENTFORTESTING.upload.pypi.org/legacy/ + verbose: true + + - name: "TEST: Release code as new release on Test Pypi" + if: ${{ startsWith(github.event.release.name,'test-') }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TEST_PASSWORD }} + repository-url: https://test.pypi.org/legacy/ + verbose: true diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pull_request.yml similarity index 96% rename from .github/workflows/pythonpackage.yml rename to .github/workflows/pull_request.yml index 6bd802c..988e39f 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pull_request.yml @@ -1,6 +1,6 @@ name: Python package -on: [pull_request] +on: [pull_request, workflow_dispatch] jobs: build: diff --git a/.github/workflows/pythonpublish_linux.yml b/.github/workflows/pythonpublish_linux.yml deleted file mode 100644 index 7f25a62..0000000 --- a/.github/workflows/pythonpublish_linux.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Upload Python Package (linux) - -on: - release: - types: [created] - workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build Linux - uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64 - with: - python-versions: "cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310" - build-requirements: "cython" - env: - USE_CYTHON: True - - name: Publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload wheelhouse/*-manylinux*.whl diff --git a/.github/workflows/pythonpublish_mac.yml b/.github/workflows/pythonpublish_mac.yml deleted file mode 100644 index 1753ab5..0000000 --- a/.github/workflows/pythonpublish_mac.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Upload Python Package (macOS) - -on: - release: - types: [created] - workflow_dispatch: - -jobs: - deploy: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - architecture: [x64] - python-version: [3.7, 3.8, 3.9, '3.10'] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - architecture: ${{ matrix.architecture }} - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine cython - - name: Build Mac - run: | - python setup.py bdist_wheel - shell: bash - env: - USE_CYTHON: True - - name: Publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload dist/*.whl diff --git a/.github/workflows/pythonpublish_sdist.yml b/.github/workflows/pythonpublish_sdist.yml deleted file mode 100644 index c7312fe..0000000 --- a/.github/workflows/pythonpublish_sdist.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Upload Python Package (SDIST) - -on: - release: - types: [created] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - python setup.py sdist - - name: Publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload dist/* diff --git a/.github/workflows/pythonpublish_windows.yml b/.github/workflows/pythonpublish_windows.yml deleted file mode 100644 index 1f6acb8..0000000 --- a/.github/workflows/pythonpublish_windows.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Upload Python Package (windows) - -on: - release: - types: [created] - workflow_dispatch: - -jobs: - deploy: - runs-on: windows-latest - strategy: - max-parallel: 3 - matrix: - python-version: [3.7, 3.8, 3.9, '3.10'] - steps: - - uses: actions/checkout@v2 - - - name: Download Build Tools for Visual Studio 2019 - run: Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools.exe - - - name: Run vs_buildtools.exe install - run: ./vs_buildtools.exe --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.140 --includeRecommended - - - name: Set up Python ${{ matrix.python-version }} x64 - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - - name: Build binary wheel - run: python setup.py bdist_wheel - - - name: Publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload dist\upolygon-*.whl