From 784d8ebccae91ca9cfd67685beba2bc7b15781d3 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:52:21 -0400 Subject: [PATCH] split workflows --- ...-and-deploy-docs.yaml => deploy-docs.yaml} | 32 ----------------- .github/workflows/test-docs.yaml | 30 ++++++++++++++++ .github/workflows/test-pytest.yaml | 34 +++++++++++++++++++ 3 files changed, 64 insertions(+), 32 deletions(-) rename .github/workflows/{test-and-deploy-docs.yaml => deploy-docs.yaml} (53%) create mode 100644 .github/workflows/test-docs.yaml create mode 100644 .github/workflows/test-pytest.yaml diff --git a/.github/workflows/test-and-deploy-docs.yaml b/.github/workflows/deploy-docs.yaml similarity index 53% rename from .github/workflows/test-and-deploy-docs.yaml rename to .github/workflows/deploy-docs.yaml index 40fde9af..2e218fc1 100644 --- a/.github/workflows/test-and-deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,41 +1,13 @@ name: Test linter, full pytest and generate docs on push on: - pull_request: - branches: - - main - - development push: branches: - main - development jobs: - testing: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.10'] - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[dev] - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest parsers - run: pytest -W error::UserWarning - - name: Run benchmark - run: pytest tests/run_benchmark.py --benchmark-json output.json - deploy_docs: - needs: testing - if: github.event_name == 'push' environment: name: ${{github.ref_name}} url: ${{ github.ref == 'main' && 'https://cioos-siooc.github.io/ocean-data-parser/main/' || 'https://cioos-siooc.github.io/ocean-data-parser/dev/' }} @@ -54,10 +26,6 @@ jobs: mkdocs-material- - run: pip install . | pip install -r docs-requirements.txt -<<<<<<< HEAD - -======= ->>>>>>> cli-docs - run: | git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml new file mode 100644 index 00000000..1f9bbb4c --- /dev/null +++ b/.github/workflows/test-docs.yaml @@ -0,0 +1,30 @@ +name: Test docs generation + +on: + pull_request: + branches: + - main + - development + + + test_docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install . | + pip install -r docs-requirements.txt + - run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + - run: | + mike deploy test diff --git a/.github/workflows/test-pytest.yaml b/.github/workflows/test-pytest.yaml new file mode 100644 index 00000000..e45a4d49 --- /dev/null +++ b/.github/workflows/test-pytest.yaml @@ -0,0 +1,34 @@ +name: Test linter and full pytest + +on: + pull_request: + branches: + - main + - development + push: + branches: + - main + - development + +jobs: + testing: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10'] + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev] + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest parsers + run: pytest -W error::UserWarning + - name: Run benchmark + run: pytest tests/run_benchmark.py --benchmark-json output.json \ No newline at end of file