Skip to content

Commit d18e038

Browse files
authored
CI update (#238)
* split nightly from generic CI * version bump actions * update poetry lock * remove usage of pkg_resources * bump poetry version * update toml and poetry lock again * fix whitespace * Rename nightly-build job to build in biweekly.yml * support version on python 3.7 * run CI on older and newer python version * add old versions back and lock poetry * fix run * another attempt * another attempt * another attempt * another attempt * another attempt * another attempt * another attempt * fix poetry lock * CI improvement * improve comment and concurrency group * add failure notification
1 parent c53b844 commit d18e038

File tree

5 files changed

+144
-66
lines changed

5 files changed

+144
-66
lines changed

.github/workflows/biweekly.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Biweekly
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 1,15 * *" # almost biweekly, twice a month
6+
7+
jobs:
8+
build:
9+
uses: ./.github/workflows/ci.yml
10+
secrets: inherit
11+
12+
notify-failure:
13+
needs:
14+
- build
15+
if: failure()
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Notify Failure
19+
uses: slackapi/slack-github-action@v1
20+
with:
21+
payload: |
22+
{
23+
"failed_workflow": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}"
24+
}
25+
env:
26+
SLACK_WEBHOOK_URL: ${{ secrets.RQE_NOTIFY_NIGHTLY_FAIL_HOOK }}

.github/workflows/ci.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,50 @@ on:
55
branches:
66
- master
77
pull_request:
8-
schedule:
9-
- cron: "0 0 * * *"
8+
workflow_call:
9+
10+
concurrency:
11+
# if the event is a pull request, use the PR number to make PR checks cancel previous runs
12+
# if the event is not a pull request, use the run number to make each run unique
13+
group: CI-${{ github.event_name == 'pull_request' && github.event.number || github.run_number }}
14+
cancel-in-progress: true
1015

1116
jobs:
1217
build:
1318
name: Test on ${{ matrix.platform }} with Python ${{ matrix.python }} with Redis ${{ matrix.redis-version }}
1419
runs-on: ${{ matrix.platform }}
1520
timeout-minutes: 40
1621
strategy:
22+
fail-fast: ${{ github.event_name == 'pull_request' }}
1723
matrix:
18-
platform: ['ubuntu-22.04', 'macos-13']
19-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
20-
redis-version: ['7.0', '7.2']
21-
fail-fast: false
24+
platform: ['ubuntu-latest', 'macos-latest']
25+
python: ['3.10', '3.14'] # min live version, latest testing
26+
redis-version: ['7.4', '8.2']
27+
# ubuntu-latest no longer supports python 3.7, macos-latest no longer supports python 3.10
28+
include:
29+
- platform: ubuntu-22.04
30+
python: '3.7'
31+
redis-version: '7.4'
32+
poetry-version: '1.5.1'
33+
- platform: macos-latest
34+
python: '3.11'
35+
redis-version: '8.2'
36+
exclude:
37+
- platform: macos-latest
38+
python: '3.10'
2239
defaults:
2340
run:
2441
shell: bash -l -eo pipefail {0}
2542

2643
steps:
2744
- name: checkout
28-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
2946
# Number of commits to fetch. 0 indicates all history for all branches and tags.
3047
with:
3148
fetch-depth: ''
3249

3350
- name: clone redis
34-
uses: actions/checkout@v3
51+
uses: actions/checkout@v4
3552
# Number of commits to fetch. 0 indicates all history for all branches and tags.
3653
with:
3754
fetch-depth: ''
@@ -40,31 +57,28 @@ jobs:
4057
path: redis
4158

4259
- name: Setup Python
43-
uses: actions/setup-python@v4
60+
uses: actions/setup-python@v5
4461
with:
4562
python-version: ${{ matrix.python }}
4663
architecture: x64
4764

4865
- name: Setup Poetry
4966
uses: snok/install-poetry@v1
5067
with:
51-
version: 1.5.1
68+
version: ${{ matrix.poetry-version || '2.2.1' }}
5269
virtualenvs-in-project: true
5370
virtualenvs-create: true
5471
installer-parallel: true
5572

5673
- name: Cache poetry
57-
uses: actions/cache@v3
74+
uses: actions/cache@v4
5875
with:
59-
path: ~/.cache/poetry # This path is specific to Ubuntu
76+
path: .venv
6077
# Look to see if there is a cache hit for the corresponding requirements file
6178
key: ${{ matrix.platform }}-${{ matrix.python }}-pyproject.toml-${{ hashFiles('pyproject.toml') }}
62-
restore-keys: |
63-
${{ matrix.platform }}-${{ matrix.python }}-pyproject.toml-${{hashFiles('pyproject.toml')}}}
64-
6579

6680
- name: Install Python dependencies
67-
run: poetry install -q
81+
run: poetry install
6882

6983
- name: Install Redis Server
7084
working-directory: redis
@@ -189,7 +203,7 @@ jobs:
189203
--tls
190204
191205
- name: Generate coverage report
192-
if: matrix.python == '3.9' && matrix.platform != 'macos-13'
206+
if: matrix.python == '3.14' && matrix.platform == 'ubuntu-latest'
193207
run: |
194208
TLS="tests/flow/tls"
195209
TLS_CERT=$TLS/redis.crt \
@@ -199,8 +213,8 @@ jobs:
199213
poetry run pytest --ignore=tests/flow --ignore=test_example.py --cov-config=.coveragerc --cov-report=xml --cov=RLTest
200214
201215
- name: Upload coverage to Codecov
202-
uses: codecov/codecov-action@v3
203-
if: matrix.python == '3.9' && matrix.platform != 'macos-13'
216+
uses: codecov/codecov-action@v4
217+
if: matrix.python == '3.14' && matrix.platform == 'ubuntu-latest'
204218
continue-on-error: true
205219
with:
206220
token: ${{ secrets.CODECOV_TOKEN }}

RLTest/_version.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
# This attribute is the only one place that the version number is written down,
33
# so there is only one place to change it when the version number changes.
44
try:
5-
import pkg_resources
6-
__version__ = pkg_resources.get_distribution('RLTest').version
7-
except (pkg_resources.DistributionNotFound, AttributeError, ImportError):
5+
from importlib.metadata import version
6+
except ImportError:
7+
try: # For Python<3.8
8+
from importlib_metadata import version # type: ignore
9+
except ImportError:
10+
version = None
11+
12+
try:
13+
__version__ = version('RLTest')
14+
except Exception:
815
__version__ = "99.99.99" # like redis modules

0 commit comments

Comments
 (0)