diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 00000000..2123856f --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,35 @@ +- name: bug + description: Something isn't working + color: d42a34 + +- name: dependencies + description: Related with project dependencies + color: ffc0cb + +- name: documentation + description: Improvements or additions to documentation + color: 0677ba + +- name: enhancement + description: New features or code improvements + color: FFD827 + +- name: good first issue + description: Easy to solve for newcomers + color: 62ca50 + +- name: maintenance + description: Package and maintenance related + color: f78c37 + +- name: release + description: Anything related to an incoming release + color: ffffff + +- name: api-definition + description: Changes to the API definition file + color: daf7a6 + +- name: code-gen + description: Changes to the code generation project configuration + color: d12dc9 diff --git a/.github/workflows/build_and_test_library.yml b/.github/workflows/build_and_test_library.yml index 3f01a340..49dc2f2f 100644 --- a/.github/workflows/build_and_test_library.yml +++ b/.github/workflows/build_and_test_library.yml @@ -7,16 +7,18 @@ on: - "*" paths: - "ansys-grantami-serverapi-openapi/**" + - ".github/workflows/build_and_test_library.yml" pull_request: paths: - "ansys-grantami-serverapi-openapi/**" + - ".github/workflows/build_and_test_library.yml" env: MAIN_PYTHON_VERSION: '3.10' + LIBRARY_NAME: 'ansys-grantami-serverapi-openapi' jobs: - tests: name: "Test Python ${{ matrix.python-version }}" runs-on: ubuntu-latest @@ -39,14 +41,14 @@ jobs: python -m pip install --upgrade pip python -m pip install poetry poetry install - working-directory: ansys-grantami-serverapi-openapi + working-directory: ${{ env.LIBRARY_NAME }} - name: "Test with pytest" - working-directory: ansys-grantami-serverapi-openapi + working-directory: ${{ env.LIBRARY_NAME }} run: poetry run pytest - name: "Run mypy" - working-directory: ansys-grantami-serverapi-openapi + working-directory: ${{ env.LIBRARY_NAME }} run: poetry run mypy build-library: @@ -68,66 +70,50 @@ jobs: python -m pip install build twine - name: "Create source and wheel artifacts" - working-directory: ansys-grantami-serverapi-openapi + working-directory: ${{ env.LIBRARY_NAME }} run: | python -m build . - name: "Validate integrity of artifacts" - working-directory: ansys-grantami-serverapi-openapi + working-directory: ${{ env.LIBRARY_NAME }} run: | python -m twine check dist/* - name: "Upload artifacts" uses: actions/upload-artifact@v4 with: - name: ansys-grantami-serverapi-openapi-wheel - path: ansys-grantami-serverapi-openapi/dist/ + name: ${{ env.LIBRARY_NAME }}-artifacts + path: ${{ env.LIBRARY_NAME }}/dist/ retention-days: 7 - release: name: "Release" - if: contains(github.ref, 'refs/tags') && github.event_name == 'push' - needs: build-library runs-on: ubuntu-latest + needs: [build-library] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') steps: + - name: "Release to public PyPI" + uses: ansys/actions/release-pypi-public@v6 + with: + library-name: ${{ env.LIBRARY_NAME }} + twine-username: "__token__" + twine-token: ${{ secrets.PYPI_TOKEN }} - - name: "Checkout the project" - uses: actions/checkout@v4 - - - name: "Set up Python ${{ env.MAIN_PYTHON_VERSION }}" - uses: actions/setup-python@v5 + - name: "Release to private PyPI" + uses: ansys/actions/release-pypi-private@v6 with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} + library-name: ${{ env.LIBRARY_NAME }} + twine-username: "__token__" + twine-token: ${{ secrets.PYPI_TOKEN }} - name: "Download distribution artifacts" uses: actions/download-artifact@v4 with: - name: ansys-grantami-serverapi-openapi-wheel - path: ~/dist - - - name: "Install Python dependencies" - run: | - python -m pip install --upgrade pip twine - - - name: "Release to private PyPI" - run: | - python -m twine upload --verbose --skip-existing --non-interactive ~/dist/*.whl - env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} - TWINE_REPOSITORY_URL: "https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload" - - - name: "Release to public PyPI" - run: | - python -m twine upload --verbose --skip-existing --non-interactive ~/dist/*.whl - env: - TWINE_USERNAME: "__token__" - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/" + name: ${{ env.LIBRARY_NAME }}-artifacts + path: ${{ env.LIBRARY_NAME }}-artifacts - name: "Release to GitHub" uses: softprops/action-gh-release@v2 with: - files: ~/dist/ansys-grantami-serverapi-openapi-wheel/*.whl - generate_release_notes: true \ No newline at end of file + files: ${{ env.LIBRARY_NAME }}-artifacts/*.whl + generate_release_notes: true diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 4a44868d..c0478010 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -3,6 +3,8 @@ on: pull_request: push: branches: [ main ] + paths: + - '../labels.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -10,14 +12,23 @@ concurrency: jobs: + label-syncer: + name: Syncer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: micnncim/action-label-syncer@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + labeler: name: Set labels permissions: contents: read pull-requests: write runs-on: ubuntu-latest + if: github.event_name == 'pull_request' steps: - - name: Label based on changed files uses: actions/labeler@v5 with: @@ -34,8 +45,8 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | Please add one of the following labels to add this contribution to the Release Notes :point_down: - - [api-definition](https://github.com/ansys/grantami-serverapi-openapi/pulls?q=label%3Aapi-definition) - - [code-gen](https://github.com/ansys/grantami-serverapi-openapi/pulls?q=label%3Acode-gen+) - - [enhancement](https://github.com/ansys/grantami-serverapi-openapi/pulls?q=label%3Aenhancement+) - - [maintenance](https://github.com/ansys/grantami-serverapi-openapi/pulls?q=label%3Amaintenance+) - - [bug](https://github.com/ansys/grantami-serverapi-openapi/pulls?q=label%3Abug+) \ No newline at end of file + - [api-definition](https://github.com/ansys/grantami-bomanalytics-openapi/pulls?q=label%3Aapi-definition) + - [code-gen](https://github.com/ansys/grantami-bomanalytics-openapi/pulls?q=label%3Acode-gen+) + - [enhancement](https://github.com/ansys/grantami-bomanalytics-openapi/pulls?q=label%3Aenhancement+) + - [maintenance](https://github.com/ansys/grantami-bomanalytics-openapi/pulls?q=label%3Amaintenance+) + - [bug](https://github.com/ansys/grantami-bomanalytics-openapi/pulls?q=label%3Abug+)