-
Notifications
You must be signed in to change notification settings - Fork 419
137 lines (118 loc) · 4.86 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master, next]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
coverage:
runs-on: ubuntu-latest
name: coverage for node@lts, redis@7
env:
node-version: lts/*
redis-version: 7-alpine
allowed_coverage_change: -0.25
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
with:
node-version: ${{ env.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ env.redis-version }}
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn coverage
- name: Upload LCOV to Coveralls
if: ${{ ( github.event_name == 'pull_request' && github.event.pull_request.head.fork == false ) || github.event_name == 'push' }}
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 # branch=master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check coverage change not below threshold
shell: bash
run: |
sleep 2
COVERAGE_CHANGE=$(curl -s https://coveralls.io/builds/${{ github.sha }}.json | jq '.coverage_change')
echo coverage changed by ${COVERAGE_CHANGE}%
if [[ -z "$(echo ${COVERAGE_CHANGE} ${{ env.allowed_coverage_change }} | awk '$1 >= $2')" ]]; then
echo current coverage change ${COVERAGE_CHANGE}% below threshold ${{ env.allowed_coverage_change }}%
exit 1
fi
compatibility:
runs-on: ubuntu-latest
name: testing node@${{ matrix.node-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [lts/*, lts/-1, lts/-2, current]
redis-version: [7-alpine]
include:
- node-version: 'lts/*'
redis-version: 6-alpine
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn test
python:
runs-on: ubuntu-latest
name: testing python@${{ matrix.python-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [lts/*]
redis-version: [7-alpine]
python-version: ['3.10']
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn copy:lua:python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 mypy types-redis
pip install -r python/requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./python --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd python
./run_tests.sh