diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 3fd6844..e3cdd1a 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -1,49 +1,11 @@ -name: Run Build Tests +name: Unit Tests on: push: - branches: - - master - pull_request: - branches: - - dev workflow_dispatch: jobs: - build_tests: - strategy: - max-parallel: 2 - matrix: - python-version: [ 3.8, 3.9, "3.10" ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Build Source Packages - run: | - python setup.py sdist - - name: Build Distribution Packages - run: | - python setup.py bdist_wheel - - name: Install repo - run: | - pip install . - - uses: pypa/gh-action-pip-audit@v1.0.8 - with: - # Ignore irrelevant Mercurial vulnerability - # Ignore `requests` and `urllib3` vulnerabilities as they are not used in this package - # Ignore `setuptools` and `pip` vulnerabilities I don't think they apply here - ignore-vulns: | - PYSEC-2023-228 - GHSA-9wx4-h78v-vm56 - GHSA-34jh-p97f-mpxf - PYSEC-2022-43012 + py_build_tests: + uses: neongeckocom/.github/.github/workflows/python_build_tests.yml@master + with: + python_version: "3.8" + diff --git a/.github/workflows/dev2master.yml b/.github/workflows/dev2master.yml deleted file mode 100644 index 1528f2c..0000000 --- a/.github/workflows/dev2master.yml +++ /dev/null @@ -1,20 +0,0 @@ -# This workflow will generate a distribution and upload it to PyPI - -name: Push dev -> master -on: - workflow_dispatch: - -jobs: - build_and_publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - ref: dev - - name: Push dev -> master - uses: ad-m/github-push-action@master - - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: master diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index e101270..5ec7120 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -1,39 +1,11 @@ name: Run License Tests on: push: - branches: - - master + workflow_dispatch: pull_request: branches: - - dev - workflow_dispatch: - + - master jobs: license_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Install core repo - run: | - pip install . - - name: Check python - id: license_check_report - uses: pilosus/action-pip-license-checker@v0.5.0 - with: - fail: 'Copyleft,Other,Error' - fails-only: true - exclude-license: '^(Mozilla).*$' - - name: Print report - if: ${{ always() }} - run: echo "${{ steps.license_check_report.outputs.report }}" + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master + diff --git a/.github/workflows/publish_alpha.yml b/.github/workflows/publish_alpha.yml deleted file mode 100644 index b4ee352..0000000 --- a/.github/workflows/publish_alpha.yml +++ /dev/null @@ -1,137 +0,0 @@ -# This workflow will generate an ALPHA release distribution and upload it to PyPI -name: Publish Alpha Build -on: - pull_request: - types: [closed] - branches: - - dev - paths-ignore: - - 'version.py' - - 'test/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'README.md' - - 'scripts/**' - -jobs: - build_and_publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: dev - fetch-depth: 0 # Avoid errors when pushing refs to the destination repository - - - name: Setup Python - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - - name: Install Build Tools - run: | - python -m pip install build wheel - - - name: Debug GitHub Labels - run: | - echo "Labels in Pull Request:" - echo "${{ toJson(github.event.pull_request.labels) }}" - - # Convert the labels array into text using jq - LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name') - - # Handle the case where there are no labels - if [ -z "$LABELS" ]; then - echo "No labels found on the pull request." - else - echo "Labels: $LABELS" - fi - - - name: Determine version bump - id: version_bump - run: | - # Convert the labels array into text using jq - LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name') - - # Handle the case where there are no labels - if [ -z "$LABELS" ]; then - echo "No labels found on the pull request." - LABELS="" - fi - - echo "Labels: $LABELS" - - MAJOR=0 - MINOR=0 - BUILD=0 - - # Loop over the labels and determine the version bump - for label in $LABELS; do - echo "Processing label: $label" - if [ "$label" == "breaking" ]; then - MAJOR=1 - elif [ "$label" == "feature" ]; then - MINOR=1 - elif [ "$label" == "fix" ]; then - BUILD=1 - fi - done - - # Set the output based on the labels found - if [ $MAJOR -eq 1 ]; then - echo "::set-output name=part::major" - elif [ $MINOR -eq 1 ]; then - echo "::set-output name=part::minor" - elif [ $BUILD -eq 1 ]; then - echo "::set-output name=part::build" - else - echo "::set-output name=part::alpha" - fi - - - name: Update version in version.py - run: | - python scripts/update_version.py ${{ steps.version_bump.outputs.part }} --version-file "$GITHUB_WORKSPACE/version.py" - - - name: "Generate release changelog" - uses: heinrichreimer/github-changelog-generator-action@v2.3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - maxIssues: 50 - id: changelog - - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment Version - branch: dev - - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: V${{ steps.version.outputs.version }} - release_name: Release ${{ steps.version.outputs.version }} - body: | - Changes in this Release - ${{ steps.changelog.outputs.changelog }} - draft: false - prerelease: true - commitish: dev - - - name: Build Distribution Packages - run: | - python setup.py sdist bdist_wheel - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{secrets.PYPI_TOKEN}} diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index 1b7b803..a2adcf9 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -7,6 +7,7 @@ on: jobs: publish_alpha: + if: github.event.pull_request.merged == true uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master secrets: inherit with: @@ -17,6 +18,22 @@ jobs: publish_prerelease: true changelog_max_issues: 100 + notify: + if: github.event.pull_request.merged == true + needs: publish_alpha + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Send message to Matrix bots channel + id: matrix-chat-message + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: 'matrix.org' + token: ${{ secrets.MATRIX_TOKEN }} + channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' + message: | + new ${{ github.event.repository.name }} PR merged! https://github.com/${{ github.repository }}/pull/${{ github.event.number }} + publish_pypi: needs: publish_alpha if: success() # Ensure this job only runs if the previous job succeeds @@ -36,20 +53,6 @@ jobs: - name: version run: echo "::set-output name=version::$(python setup.py --version)" id: version - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: V${{ steps.version.outputs.version }} - release_name: Release ${{ steps.version.outputs.version }} - body: | - Changes in this Release - ${{ steps.changelog.outputs.changelog }} - draft: false - prerelease: true - commitish: dev - name: Build Distribution Packages run: | python setup.py sdist bdist_wheel @@ -102,4 +105,3 @@ jobs: -H "Authorization: token $GITHUB_TOKEN" \ -d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$HEAD_BRANCH\",\"base\":\"$BASE_BRANCH\"}" \ https://api.github.com/repos/${{ github.repository }}/pulls -