diff options
author | Micah Jerome Ellison <micah.jerome.ellison@gmail.com> | 2022-01-08 12:36:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 12:36:58 -0800 |
commit | 3b0c7992d24da5a3ede0882a8825f6a579e7b6b0 (patch) | |
tree | 41d76fbfee363bc2e31f6973013b39d91652b8ef /.github | |
parent | bb0d96a0057ea8cea8a5e994bcecb33e88bb4472 (diff) |
Add weekly Saturday morning build and prevent Python 3.11 from running on PRs (#1387)
* Add weekly Saturday morning build and prevent Python 3.11 from running on PRs
* Fix extraneous greater than symbol
* Add branches and paths to cron schedule
* Add back missing hyphen before cron
* Trying to fix YAML syntax error
* Remove branches and paths from schedule
* Fix invalid conditional, push 3.11 check down to actual tests like we did with 3.10
* Separate out PR tests and scheduled tests
* Fix YAML syntax
* Fix uses action reference
* Use proper action folder structure
* Check out repo before running local action
* Specify bash shell and remove unneeded if
* Specify shell for each run statement
* Move secret out of composite action since it is not supported directly
* Fix half-fixed previous commit
* Remove extraneous ./
* Fix pathing and name steps
* take out shell key from action
* put back missing git config line in workflows
Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/actions/run_tests/action.yaml | 61 | ||||
-rw-r--r-- | .github/workflows/testing.yaml | 84 | ||||
-rw-r--r-- | .github/workflows/testing_prs.yaml | 43 | ||||
-rw-r--r-- | .github/workflows/testing_schedule.yaml | 25 |
4 files changed, 129 insertions, 84 deletions
diff --git a/.github/actions/run_tests/action.yaml b/.github/actions/run_tests/action.yaml new file mode 100644 index 00000000..3f40f2fd --- /dev/null +++ b/.github/actions/run_tests/action.yaml @@ -0,0 +1,61 @@ +name: run jrnl tests
+description: Runs all jrnl tests on multiple platforms
+inputs:
+ cache-string:
+ description: 'Cache string secret. Change to bust the cache'
+ required: true
+runs:
+ using: "composite"
+ steps:
+ - run: git config --global core.autocrlf false
+ shell: bash
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Capture full Python version in env
+ run: echo "PYTHON_FULL_VERSION=$(python --version)" >> $GITHUB_ENV
+ shell: bash
+
+ - name: poetry cache # Change CACHE_STRING secret to bust the cache
+ uses: actions/cache@v2
+ with:
+ path: .venv
+ key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ inputs.cache-string }}
+
+ - name: Install dependencies
+ run: |
+ echo '::group::poetry'
+ pip --disable-pip-version-check install poetry
+ poetry config --local virtualenvs.in-project true
+ echo '::endgroup::'
+
+ echo '::group::Other dependencies'
+ poetry install --remove-untracked
+ echo '::endgroup::'
+
+ echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV
+ shell: bash
+
+ - name: Code formatting (Black)
+ if: ${{ env.DEPS_INSTALLED == 'true' }}
+ run: |
+ poetry run black --version
+ poetry run black --check --diff .
+ shell: bash
+
+ - name: Code Style (flake8)
+ if: >
+ ${{ env.DEPS_INSTALLED == 'true' }}
+ run: |
+ poetry run pflake8 --version
+ poetry run pflake8 jrnl tests
+ shell: bash
+
+ - name: Test with pytest
+ if: >
+ ${{ env.DEPS_INSTALLED == 'true' }}
+ run: poetry run pytest --junitxml=reports/pytest/results.xml
+ shell: bash
diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml deleted file mode 100644 index 27d839f2..00000000 --- a/.github/workflows/testing.yaml +++ /dev/null @@ -1,84 +0,0 @@ -name: Testing - -on: - push: - branches: [ develop, release ] - paths: - - 'jrnl/**' - - 'features/**' - - 'tests/**' - - 'poetry.lock' - - 'pyproject.toml' - - '.github/workflows/testing.yaml' - pull_request: - branches: [ develop ] - paths: - - 'jrnl/**' - - 'features/**' - - 'tests/**' - - 'poetry.lock' - - 'pyproject.toml' - - '.github/workflows/testing.yaml' - -defaults: - run: - shell: bash # needed to prevent Windows from using PowerShell - -jobs: - test: - if: > - ! contains(github.event.head_commit.message, '[ci skip]') - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.python-version == '3.11-dev' }} - strategy: - fail-fast: false - matrix: - python-version: [ 3.7, 3.8, 3.9, '3.10', 3.11-dev ] - os: [ ubuntu-latest, macos-latest, windows-latest ] - - steps: - - run: git config --global core.autocrlf false - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Capture full Python version in env - run: echo "PYTHON_FULL_VERSION=$(python --version)" >> $GITHUB_ENV - - - name: poetry cache # Change CACHE_STRING secret to bust the cache - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ env.PYTHON_FULL_VERSION }}-${{ secrets.CACHE_STRING }} - - - name: Install dependencies - run: | - echo '::group::poetry' - pip --disable-pip-version-check install poetry - poetry config --local virtualenvs.in-project true - echo '::endgroup::' - - echo '::group::Other dependencies' - poetry install --remove-untracked - echo '::endgroup::' - - echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV - - - name: Code formatting (Black) - if: ${{ env.DEPS_INSTALLED == 'true' }} - run: | - poetry run black --version - poetry run black --check --diff . - - - name: Code Style (flake8) - if: ${{ env.DEPS_INSTALLED == 'true' }} - run: | - poetry run pflake8 --version - poetry run pflake8 jrnl tests - - - name: Test with pytest - if: ${{ env.DEPS_INSTALLED == 'true' }} - run: poetry run pytest --junitxml=reports/pytest/results.xml diff --git a/.github/workflows/testing_prs.yaml b/.github/workflows/testing_prs.yaml new file mode 100644 index 00000000..aabe14b3 --- /dev/null +++ b/.github/workflows/testing_prs.yaml @@ -0,0 +1,43 @@ +name: Testing + +on: + push: + branches: [ develop, release ] + paths: + - 'jrnl/**' + - 'features/**' + - 'tests/**' + - 'poetry.lock' + - 'pyproject.toml' + - '.github/workflows/testing.yaml' + pull_request: + branches: [ develop ] + paths: + - 'jrnl/**' + - 'features/**' + - 'tests/**' + - 'poetry.lock' + - 'pyproject.toml' + - '.github/workflows/testing.yaml' + +defaults: + run: + shell: bash # needed to prevent Windows from using PowerShell + +jobs: + test: + if: > + ! contains(github.event.head_commit.message, '[ci skip]') + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, '3.10' ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + steps: + - run: git config --global core.autocrlf false + - uses: actions/checkout@v2 + - name: Run tests + uses: ./.github/actions/run_tests + with: + cache-string: ${{ secrets.CACHE_STRING }} diff --git a/.github/workflows/testing_schedule.yaml b/.github/workflows/testing_schedule.yaml new file mode 100644 index 00000000..72e47de4 --- /dev/null +++ b/.github/workflows/testing_schedule.yaml @@ -0,0 +1,25 @@ +name: Testing + +on: + schedule: + - cron: '0 0 * * SAT' + +defaults: + run: + shell: bash # needed to prevent Windows from using PowerShell + +jobs: + test_all: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, '3.10', 3.11-dev ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + steps: + - run: git config --global core.autocrlf false + - uses: actions/checkout@v2 + - name: Run tests + uses: ./.github/actions/run_tests + with: + cache-string: ${{ secrets.CACHE_STRING }} |