Skip to content

Commit

Permalink
Merge branch 'master' into release-match-list
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver authored Mar 11, 2024
2 parents 59e1e87 + 975d403 commit c0e132c
Show file tree
Hide file tree
Showing 348 changed files with 13,491 additions and 4,102 deletions.
5 changes: 3 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ coverage:
project:
default:
# commits below this threshold will be marked as failed
target: '85%'
target: '92%'
# how much we allow the coverage to drop
threshold: '2%'
patch:
default:
target: '95%'
target: '97%'
threshold: '5%'

# files to ignore
ignore:
- "tests/**"
- "ws_messages_pb2.py"
- "cylc/flow/scripts/report_timings.py"

flag_management:
default_rules:
Expand Down
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ omit =
tests/*
*/cylc/flow/*_pb2.py
cylc/flow/etc/*
cylc/flow/scripts/report_timings.py
parallel = True
source = ./cylc
timid = False
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/1_create_release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: cylc/release-actions/check-shortlog@v1

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/2_auto_publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
ref: ${{ env.MERGE_SHA }}

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -38,7 +38,7 @@ jobs:
uses: cylc/release-actions/build-python-package@v1

- name: Publish distribution to PyPI
uses: pypa/[email protected].10
uses: pypa/[email protected].14
with:
user: __token__ # uses the API token feature of PyPI - least permissions possible
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Upload artifact
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Upload cylc-run artifact
name: 'cylc-run (bash-${{ matrix.bash-version }})'
path: cylc-run
110 changes: 4 additions & 106 deletions .github/workflows/branch_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,109 +14,7 @@ on:

jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
BASE_BRANCH: master
HEAD_BRANCH: ${{ inputs.head_branch || github.ref_name }}
STATUS_JSON: https://raw.githubusercontent.com/cylc/cylc-admin/master/docs/status/branches.json
FORCE_COLOR: 2
steps:
- name: Check branch name
shell: python
run: |
import os
import json
import sys
from urllib.request import urlopen
if os.environ['GITHUB_EVENT_NAME'] == 'schedule':
# Get branch from status page
meta = json.loads(
urlopen(os.environ['STATUS_JSON']).read()
)['meta_releases']
version = min(meta)
branch = meta[version][os.environ['GITHUB_REPOSITORY']]
else:
branch = os.environ['HEAD_BRANCH'].strip()
if branch.endswith('-sync'):
sys.exit("::error::Do not run this workflow for already-created sync branches")
with open(os.environ['GITHUB_ENV'], 'a') as F:
print(f'HEAD_BRANCH={branch}', file=F)
print(f'SYNC_BRANCH={branch}-sync', file=F)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master

- name: Configure git
uses: cylc/release-actions/configure-git@v1

- name: Checkout sync branch if it exists
continue-on-error: true
run: |
git switch -c "$SYNC_BRANCH" "origin/${SYNC_BRANCH}"
echo "BASE_BRANCH=$SYNC_BRANCH" >> "$GITHUB_ENV"
- name: Attempt fast-forward
id: ff
run: |
if git merge "origin/${HEAD_BRANCH}" --ff-only; then
if [[ "$(git rev-parse HEAD)" == "$(git rev-parse "origin/${BASE_BRANCH}")" ]]; then
echo "::notice::$BASE_BRANCH is up to date with $HEAD_BRANCH"
exit 0
fi
git push origin "$BASE_BRANCH"
elif [[ "$BASE_BRANCH" == "$SYNC_BRANCH" ]]; then
echo "::notice::Cannot fast-forward $BASE_BRANCH to $HEAD_BRANCH; merge existing PR first"
else
echo "continue=true" >> "$GITHUB_OUTPUT"
fi
- name: Attempt merge into master
id: merge
if: steps.ff.outputs.continue
run: |
git switch master
if git merge "origin/${HEAD_BRANCH}"; then
if git diff HEAD^ --exit-code --stat; then
echo "::notice::No diff between master and $HEAD_BRANCH"
exit 0
fi
else
git merge --abort
fi
echo "continue=true" >> $GITHUB_OUTPUT
- name: Push sync branch
id: push
if: steps.merge.outputs.continue
run: |
git switch -c "$SYNC_BRANCH" "origin/${HEAD_BRANCH}"
git push origin "$SYNC_BRANCH"
echo "continue=true" >> $GITHUB_OUTPUT
- name: Open PR
if: steps.push.outputs.continue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BODY: |
Please do a **normal merge**, not squash merge.
Please fix conflicts if necessary.
---
Triggered by `${{ github.event_name }}`
run: |
url="$(
gh pr create --head "$SYNC_BRANCH" \
--title "🤖 Merge ${SYNC_BRANCH} into master" \
--body "$BODY"
)"
echo "::notice::PR created at ${url}"
gh pr edit "$SYNC_BRANCH" --add-label "sync" || true
uses: cylc/release-actions/.github/workflows/branch-sync.yml@v1
with:
head_branch: ${{ inputs.head_branch }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand Down
102 changes: 61 additions & 41 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,38 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false # Don't let a failed MacOS run stop the Ubuntu runs
fail-fast: false # don't stop on first failure
matrix:
os: ['ubuntu-latest']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.10', '3.11', '3']
include:
- os: 'macos-latest'
python-version: '3.7'
# mac os test
- os: 'macos-11'
python-version: '3.7' # oldest supported version

# non-utc timezone test
- os: 'ubuntu-latest'
python-version: '3.9' # not the oldest, not the most recent version
time-zone: 'XXX-09:35'

env:
TZ: ${{ matrix.time-zone }}
PYTEST_ADDOPTS: --cov --cov-append -n 5 --color=yes

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Apt-Get Install
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y shellcheck sqlite3
sudo apt-get install -y sqlite3
- name: Install
run: |
Expand All @@ -48,37 +57,10 @@ jobs:
- name: Configure git # Needed by the odd test
uses: cylc/release-actions/configure-git@v1

- name: Check changelog
if: startsWith(matrix.os, 'ubuntu')
run: towncrier build --draft

- name: Style
if: startsWith(matrix.os, 'ubuntu')
run: |
flake8
etc/bin/shellchecker
# note: exclude python 3.10+ from mypy checks as these produce false
# positives in installed libraries for python 3.7
- name: Typing
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python-version, 3.9)
run: mypy

- name: Doctests
timeout-minutes: 4
run: |
pytest cylc/flow
- name: Unit Tests
timeout-minutes: 4
timeout-minutes: 5
run: |
pytest tests/unit
- name: Bandit
if: ${{ matrix.python-version == '3.7' }}
# https://github.com/PyCQA/bandit/issues/658
run: |
bandit -r --ini .bandit cylc/flow
pytest cylc/flow tests/unit
- name: Integration Tests
timeout-minutes: 6
Expand All @@ -87,7 +69,7 @@ jobs:
- name: Upload failed tests artifact
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cylc-run (${{ matrix.os }} py-${{ matrix.python-version }})
path: ~/cylc-run/
Expand All @@ -98,15 +80,53 @@ jobs:
coverage report
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }}
path: coverage.xml
retention-days: 7

lint:
runs-on: 'ubuntu-latest'
timeout-minutes: 10
steps:
- name: Apt-Get Install
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Checkout
uses: actions/checkout@v4

# note: exclude python 3.10+ from mypy checks as these produce false
# positives in installed libraries for python 3.7
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install
run: |
pip install -e ."[tests]"
- name: Flake8
run: flake8

- name: Bandit
run: |
bandit -r --ini .bandit cylc/flow
- name: Shellchecker
run: etc/bin/shellchecker

- name: MyPy
run: mypy

- name: Towncrier
run: towncrier build --draft

- name: Linkcheck
if: startsWith(matrix.python-version, '3.10')
run: pytest -m linkcheck --dist=load tests/unit
run: pytest -m linkcheck --dist=load --color=yes -n 10 tests/unit/test_links.py

codecov:
needs: test
Expand All @@ -117,10 +137,10 @@ jobs:
uses: actions/checkout@v4

- name: Download coverage artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Codecov upload
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
flags: fast-tests
Expand Down
Loading

0 comments on commit c0e132c

Please sign in to comment.