diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index efbda27..cbd3781 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -2,72 +2,52 @@ name: Build and test Python package on: push: - branches: [main] + branches: + - main pull_request: - branches: [main] jobs: linting: name: Linting - runs-on: "ubuntu-latest" strategy: matrix: python-version: - - 3.7 - - 3.8 - - 3.9 + - "3.7" + - "3.8" + - "3.9" - "3.10" - steps: - - uses: actions/checkout@v3 - - name: Install and check with black, pylint and pontos.version - uses: greenbone/actions/lint-python@v2 - with: - packages: mattermost_notify tests - version: ${{ matrix.python-version }} + - "3.11" + uses: greenbone/workflows/.github/workflows/lint-python.yml@main + with: + lint-packages: mattermost_notify tests + python-version: ${{ matrix.python-version }} test: - name: Run all tests - runs-on: "ubuntu-latest" + name: Run tests strategy: matrix: python-version: - - 3.7 - - 3.8 - - 3.9 + - "3.7" + - "3.8" + - "3.9" - "3.10" - steps: - - uses: actions/checkout@v3 - - name: Install python, poetry and dependencies - uses: greenbone/actions/poetry@v2 - with: - version: ${{ matrix.python-version }} - - name: Run unit tests - run: | - poetry run python -m unittest -v - env: - NASLINTER_DOCKER_RUN: "true" + - "3.11" + uses: greenbone/workflows/.github/workflows/test-python.yml@main + with: + python-version: ${{ matrix.python-version }} codecov: name: Upload coverage to codecov.io - needs: test runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v3 - - name: Install python, poetry and dependencies - uses: greenbone/actions/poetry@v2 + - name: Calculate and upload coverage to codecov.io + uses: greenbone/actions/coverage-python@v2 with: - version: "3.10" - - name: Install codecov-python - run: poetry run python -m pip install codecov - - name: Run unit tests - run: | - poetry run coverage run -m unittest -v - env: - NASLINTER_DOCKER_RUN: "true" - - name: Create coverage XML report - run: poetry run coverage xml - - name: Upload coverage to codecov.io - uses: codecov/codecov-action@v3 - with: - token: ${{ inputs.token }} - fail_ci_if_error: true + python-version: "3.10" + cache: "true" + token: ${{ secrets.CODECOV_TOKEN }} + + check-version: + name: Check versioning for consistency + uses: greenbone/workflows/.github/workflows/check-version.yml@main diff --git a/.github/workflows/deploy-pypi.yml b/.github/workflows/deploy-pypi.yml index 628eacc..b31d0b7 100644 --- a/.github/workflows/deploy-pypi.yml +++ b/.github/workflows/deploy-pypi.yml @@ -6,9 +6,5 @@ on: jobs: deploy: - runs-on: ubuntu-latest - steps: - - name: Build and publish to PyPI - uses: greenbone/actions/pypi-upload@v2 - with: - pypi-token: ${{ secrets.PYPI_TOKEN }} + uses: greenbone/workflows/.github/workflows/deploy-pypi.yml@main + secrets: inherit diff --git a/.github/workflows/release-pontos.yml b/.github/workflows/release-pontos.yml index abf0994..9c759a7 100644 --- a/.github/workflows/release-pontos.yml +++ b/.github/workflows/release-pontos.yml @@ -7,28 +7,6 @@ on: jobs: build-and-release: - name: Create a new release with pontos - # If the event is a workflow_dispatch or the label 'make release' is set and PR is closed because of a merge - if: (github.event_name == 'workflow_dispatch') || (contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true) - runs-on: "ubuntu-latest" - steps: - - name: Setting the Reference - run: | - if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then - echo "RELEASE_REF=${{ github.ref_name }}" >> $GITHUB_ENV - else - echo "RELEASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV - fi - - name: Release with release action - uses: greenbone/actions/release@v2 - with: - python-version: "3.10" - conventional-commits: true - github-user: ${{ secrets.GREENBONE_BOT }} - github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }} - github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }} - gpg-key: ${{ secrets.GPG_KEY }} - gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }} - gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} - strategy: calendar - ref: ${{ env.RELEASE_REF }} + name: Create a new release + uses: greenbone/workflows/.github/workflows/release-python.yml@main + secrets: inherit