From fbeef15adebce5da5643f927a18e69b30b6bf447 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Wed, 9 Nov 2022 10:28:50 +0100 Subject: [PATCH] Add nightly build and make ci quicker --- .github/workflows/ci_cd.yml | 59 ++----------- .github/workflows/nightly.yml | 153 ++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index e3df5b390..35f2fa805 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -7,8 +7,6 @@ on: - "*" branches: - main - schedule: - - cron: "0 2 * * 1-5" env: MAIN_PYTHON_VERSION: '3.7' @@ -34,24 +32,6 @@ jobs: - name: Test with tox run: tox -e style - #docs-style: - # name: Documentation Style Check - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - # - name: Running Vale - # uses: errata-ai/vale-action@reviewdog - # env: - # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - # with: - # files: doc - # reporter: github-pr-check - # level: error - # filter_mode: nofilter - # fail_on_error: true - # vale_flags: "--config=doc/.vale.ini" - quick-tests: name: Quick tests and coverage runs-on: ${{ matrix.os }} @@ -59,9 +39,8 @@ jobs: # max 1 job at a time running against the server to make it more robust max-parallel: 1 matrix: - os: [windows-latest, ubuntu-latest] + os: [ubuntu-latest] cfg: - - {python-version: "3.7", toxenv: "py37"} - {python-version: "3.10", toxenv: "py310"} fail-fast: false @@ -89,34 +68,6 @@ jobs: report_paths: '**/test*.xml' check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} - end-to-end-tests: - name: End-to-end tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} - uses: actions/setup-python@v4 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools tox tox-gh-actions - - - name: Test with tox - run: tox -e py37-witheval - env: - REP_TEST_URL: https://repkube.westeurope.cloudapp.azure.com/dev/rep - REP_TEST_USERNAME: repadmin - REP_TEST_PASSWORD: ${{ secrets.REPADMIN_PASSWORD }} - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v3 - if: always() - with: - report_paths: '**/test*.xml' - check_name: End-to-end Test Report - docs: name: Documentation runs-on: ubuntu-latest @@ -160,9 +111,17 @@ jobs: python -m build venv wheel python -m twine check dist/* - name: Upload to private PyPi + if: github.ref == 'refs/heads/main' run: | python -m twine upload --verbose --skip-existing 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: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: pyrep-package + path: | + dist/*.whl + retention-days: 5 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..830c0019f --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,153 @@ +name: Nightly Build +on: + workflow_dispatch: + schedule: + - cron: "0 2 * * 1-5" + +env: + MAIN_PYTHON_VERSION: '3.7' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + style: + name: Code style + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools tox + - name: Test with tox + run: tox -e style + + quick-tests: + name: Quick tests and coverage + runs-on: ${{ matrix.os }} + strategy: + # max 1 job at a time running against the server to make it more robust + max-parallel: 1 + matrix: + os: [windows-latest, ubuntu-latest] + cfg: + - {python-version: "3.7", toxenv: "py37"} + - {python-version: "3.10", toxenv: "py310"} + fail-fast: false + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.cfg.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.cfg.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools tox tox-gh-actions + + - name: Test with tox + run: tox -e ${{ matrix.cfg.toxenv }}-noeval-coverage + env: + REP_TEST_URL: https://repkube.westeurope.cloudapp.azure.com/dev/rep + REP_TEST_USERNAME: repadmin + REP_TEST_PASSWORD: ${{ secrets.REPADMIN_PASSWORD }} + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: '**/test*.xml' + check_name: Test Report ${{ matrix.os }}:${{ matrix.cfg.python-version }} + + end-to-end-tests: + name: End-to-end tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools tox tox-gh-actions + + - name: Test with tox + run: tox -e py37-witheval + env: + REP_TEST_URL: https://repkube.westeurope.cloudapp.azure.com/dev/rep + REP_TEST_USERNAME: repadmin + REP_TEST_PASSWORD: ${{ secrets.REPADMIN_PASSWORD }} + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: '**/test*.xml' + check_name: End-to-end Test Report + + docs: + name: Documentation + runs-on: ubuntu-latest + # needs: docs-style + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools tox + - name: Generate the documentation with tox + run: tox -e doc + - name: Add gh-pages parameters + run: | + touch build/sphinx/html/.nojekyll + echo "dev.rep.docs.pyansys.com" >> build/sphinx/html/CNAME + - name: Deploy Documentation + if: github.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + branch: gh-pages + folder: build/sphinx/html + clean: true + + build: + name: Build and publish library + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + - name: Install dependencies and build the library + run: | + python -m pip install --upgrade pip setuptools + python -m pip install -r requirements/requirements_build.txt + python -m build venv wheel + python -m twine check dist/* + - name: Upload to private PyPi + if: github.ref == 'refs/heads/main' + run: | + python -m twine upload --verbose --skip-existing 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: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: pyrep-package + path: | + dist/*.whl + retention-days: 5 +