Skip to content

Commit

Permalink
Fixed scheduled test runs; Fixed releasing/starting a version docs
Browse files Browse the repository at this point in the history
Details:

* The test.yml workflow already had a 'schedule' event defined, but only
  in the manual-ci-run branch and not in the master branch. However, it
  turns out that GitHub Actions only runs the schedule event on the
  master branch.

  This change fixes that by adding a new job 'set_matrix' in the test.yml
  workflow that determines the test matrix to run based on the event type.
  For scheduled events, the matrix is set to the full set of environments,
  and otherwise, to the normal smaller set.

  This allowed to abandon the manual-ci-run branch and its PR.

* The description in the development section of the documentation on how
  to release a version or how to start a new version had several issues
  (the most significant one being that it did not account for a stable
  branch that is maintained as a fix stream). This change fixes all
  the issues.

* The description how to release a version missed a step to add the new
  version to RTD. What gets added to RTD are the version tags, and
  the latest and stable versions as defined in RTD. the stable_M.N
  branches do not show up on RTD because that is too confusing.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed Dec 31, 2020
1 parent bc2614f commit aa24a41
Show file tree
Hide file tree
Showing 2 changed files with 309 additions and 239 deletions.
128 changes: 77 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,100 @@
name: test

on:
# schedule:
# # minute hour day_of_month month day_of_week
# - cron: '10 21 * * 0' # Every sunday at 21:10 UTC
schedule:
# The schedule event always (and only) runs on the master branch.
- # cron (in UTC): minute hour day_of_month month day_of_week
cron: '00 03 * * SUN'
push:
branches: [ master, stable_1.1 ]
pull_request:
branches: [ master, stable_1.1 ]

jobs:

set_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.select_matrix.outputs.matrix }}
steps:
- name: "Select matrix"
id: select_matrix
# Select full matrix when scheduled or when releasing, and normal matrix
# otherwise. The matrix is defined as a JSON string.
# TODO: Find a way to define this with less escapes.
run: |
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.head_ref }}" =~ ^release_ ]]; then \
echo "::set-output name=matrix::{ \
\"os\": [ \"ubuntu-latest\", \"macos-latest\", \"windows-latest\" ], \
\"python-version\": [ \"2.7\", \"3.4\", \"3.5\", \"3.6\", \"3.7\", \"3.8\", \"3.9\" ], \
\"package_level\": [ \"minimum\", \"latest\" ], \
\"exclude\": [ \
{ \
\"os\": \"macos-latest\", \
\"python-version\": \"3.4\", \
\"package_level\": \"minimum\" \
}, \
{ \
\"os\": \"macos-latest\", \
\"python-version\": \"3.4\", \
\"package_level\": \"latest\" \
}, \
{ \
\"os\": \"windows-latest\", \
\"python-version\": \"3.4\", \
\"package_level\": \"minimum\" \
}, \
{ \
\"os\": \"windows-latest\", \
\"python-version\": \"3.4\", \
\"package_level\": \"latest\" \
} \
] \
}"; \
else \
echo "::set-output name=matrix::{ \
\"os\": [ \"ubuntu-latest\" ], \
\"python-version\": [ \"2.7\", \"3.4\", \"3.9\" ], \
\"package_level\": [ \"minimum\", \"latest\" ], \
\"include\": [ \
{ \
\"os\": \"macos-latest\", \
\"python-version\": \"3.9\", \
\"package_level\": \"latest\" \
}, \
{ \
\"os\": \"windows-latest\", \
\"python-version\": \"3.8\", \
\"package_level\": \"minimum\" \
}, \
{ \
\"os\": \"windows-latest\", \
\"python-version\": \"3.9\", \
\"package_level\": \"minimum\" \
}, \
{ \
\"os\": \"windows-latest\", \
\"python-version\": \"3.9\", \
\"package_level\": \"latest\" \
} \
] \
}"; \
fi
- name: Show matrix in JSON
run: echo '${{ steps.select_matrix.outputs.matrix }}'

test:
needs: set_matrix
strategy:
fail-fast: false
max-parallel: 20
# # The matrix for the all-environment pull request:
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9]
# package_level: [minimum, latest]
# exclude:
# - os: macos-latest
# python-version: 3.4
# package_level: minimum
# - os: macos-latest
# python-version: 3.4
# package_level: latest
# - os: windows-latest
# python-version: 3.4
# package_level: minimum
# - os: windows-latest
# python-version: 3.4
# package_level: latest
# The matrix for normal pull requests:
matrix:
os: [ubuntu-latest]
python-version: [2.7, 3.4, 3.9]
package_level: [minimum, latest]
include:
- os: macos-latest
python-version: 3.9
package_level: latest
- os: windows-latest
python-version: 3.8
package_level: minimum
- os: windows-latest
python-version: 3.9
package_level: minimum
- os: windows-latest
python-version: 3.9
package_level: latest
matrix: ${{ fromJson(needs.set_matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Rebase manual-ci-run to master
if: ${{ github.head_ref == 'manual-ci-run' }}
run: |
echo "Fetching and defining master:"
git fetch origin master
git branch master FETCH_HEAD
echo "Log back to master:"
git log master~..HEAD --oneline --decorate
echo "Rebasing to master:"
git rebase master
echo "Log back to master:"
git log master~..HEAD --oneline --decorate
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down
Loading

0 comments on commit aa24a41

Please sign in to comment.