@@ -16,144 +16,104 @@ jobs:
16
16
matrix :
17
17
os : [ubuntu-latest, windows-latest, macos-latest]
18
18
python-version : ["3.13"]
19
- include :
20
- # Test on additional Python versions on Ubuntu only
21
- - os : ubuntu-latest
22
- python-version : " 3.13"
23
-
24
- continue-on-error : ${{ matrix.experimental == true }}
25
19
26
20
steps :
27
- - uses : actions/checkout@v4
28
-
29
- - name : Set up Python ${{ matrix.python-version }}
30
- uses : actions/setup-python@v5
31
- with :
32
- python-version : ${{ matrix.python-version }}
33
- cache : ' pip'
34
- cache-dependency-path : |
35
- pyproject.toml
36
-
37
- - name : Install dependencies
38
- run : |
39
- python -m pip install --upgrade pip
40
- pip cache purge
41
- pip install --no-cache-dir -e ".[dev]"
42
-
43
- - name : Run tests with pytest
44
- run : |
45
- pytest -v --cov=thegraph_token_api --cov-report=term-missing --cov-report=xml --cov-report=html
46
-
47
- - name : Upload coverage to Codecov
48
- if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
49
- uses : codecov/codecov-action@v5
50
- with :
51
- file : ./coverage.xml
52
- flags : unittests
53
- name : codecov-umbrella
54
- fail_ci_if_error : false
55
- token : ${{ secrets.CODECOV_TOKEN }}
56
-
57
- - name : Upload coverage reports
58
- if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
59
- uses : actions/upload-artifact@v4
60
- with :
61
- name : coverage-report
62
- path : htmlcov/
63
-
64
- - name : Check coverage threshold
65
- if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
66
- run : |
67
- coverage report --fail-under=90
21
+ - uses : actions/checkout@v4
22
+
23
+ - name : Set up Python ${{ matrix.python-version }}
24
+ uses : actions/setup-python@v5
25
+ with :
26
+ python-version : ${{ matrix.python-version }}
27
+
28
+ - name : Install Poetry via pip
29
+ run : |
30
+ python -m pip install --upgrade pip poetry
31
+
32
+ - name : Install dependencies
33
+ run : poetry install --no-interaction --with dev --no-root
34
+
35
+ - name : Run tests with pytest
36
+ run : poetry run pytest -v --cov=thegraph_token_api --cov-report=term-missing --cov-report=xml --cov-report=html
37
+ shell : bash
38
+
39
+ - name : Upload coverage to Codecov
40
+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
41
+ uses : codecov/codecov-action@v5
42
+ with :
43
+ file : ./coverage.xml
44
+ flags : unittests
45
+ name : codecov-umbrella
46
+ fail_ci_if_error : false
47
+ token : ${{ secrets.CODECOV_TOKEN }}
48
+
49
+ - name : Upload coverage reports
50
+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
51
+ uses : actions/upload-artifact@v4
52
+ with :
53
+ name : coverage-report
54
+ path : htmlcov/
55
+
56
+ - name : Check coverage threshold
57
+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
58
+ run : poetry run coverage report --fail-under=90
68
59
69
60
lint :
70
61
runs-on : ubuntu-latest
71
62
steps :
72
- - uses : actions/checkout@v4
63
+ - uses : actions/checkout@v4
73
64
74
- - name : Set up Python
75
- uses : actions/setup-python@v5
76
- with :
77
- python-version : " 3.13"
78
- cache : ' pip'
65
+ - name : Set up Python
66
+ uses : actions/setup-python@v5
67
+ with :
68
+ python-version : " 3.13"
79
69
80
- - name : Install dependencies
81
- run : |
82
- python -m pip install --upgrade pip
83
- pip cache purge
84
- pip install --no-cache-dir -e ".[dev]"
70
+ - name : Install Poetry via pip
71
+ run : |
72
+ python -m pip install --upgrade pip poetry
85
73
86
- - name : Run ruff linter
87
- run : |
88
- ruff check --output-format=github .
74
+ - name : Install dependencies
75
+ run : poetry install --no-interaction --with dev --no-root
89
76
90
- - name : Run ruff formatter
91
- run : |
92
- ruff format --check .
77
+ - name : Run ruff linter
78
+ run : poetry run ruff check --output-format=github .
93
79
94
- - name : Run mypy
95
- run : |
96
- mypy src/thegraph_token_api --ignore-missing-imports
80
+ - name : Run ruff formatter
81
+ run : poetry run ruff format --check .
97
82
98
- - name : Run bandit security scan
99
- run : |
100
- bandit -r src/ -f txt
83
+ - name : Run mypy
84
+ run : poetry run mypy src/thegraph_token_api --ignore-missing-imports
101
85
102
- - name : Run safety dependency check
103
- run : |
104
- safety check
86
+ - name : Run bandit security scan
87
+ run : poetry run bandit -r src/ -f txt
105
88
106
- security :
107
- runs-on : ubuntu-latest
108
- if : github.event_name != 'workflow_call'
109
- permissions :
110
- security-events : write
111
- contents : read
112
- steps :
113
- - uses : actions/checkout@v4
114
-
115
- - name : Run Trivy vulnerability scanner
116
- uses : aquasecurity/trivy-action@master
117
- with :
118
- scan-type : ' fs'
119
- scan-ref : ' .'
120
- format : ' sarif'
121
- output : ' trivy-results.sarif'
122
- severity : ' CRITICAL,HIGH'
123
-
124
- - name : Upload Trivy scan results to GitHub Security tab
125
- uses : github/codeql-action/upload-sarif@v3
126
- if : always()
127
- with :
128
- sarif_file : ' trivy-results.sarif'
89
+ - name : Run safety dependency check
90
+ run : poetry run safety check
129
91
130
92
build :
131
93
runs-on : ubuntu-latest
132
94
needs : [test]
133
95
steps :
134
- - uses : actions/checkout@v4
135
-
136
- - name : Set up Python
137
- uses : actions/setup-python@v5
138
- with :
139
- python-version : " 3.13"
140
- cache : ' pip'
141
-
142
- - name : Install build dependencies
143
- run : |
144
- python -m pip install --upgrade pip
145
- pip install build
146
-
147
- - name : Build package
148
- run : |
149
- python -m build
150
-
151
- - name : Check dist contents
152
- run : |
153
- ls -la dist/
154
-
155
- - name : Upload artifacts
156
- uses : actions/upload-artifact@v4
157
- with :
158
- name : dist-packages
159
- path : dist/
96
+ - uses : actions/checkout@v4
97
+
98
+ - name : Set up Python
99
+ uses : actions/setup-python@v5
100
+ with :
101
+ python-version : " 3.13"
102
+
103
+ - name : Install Poetry via pip
104
+ run : |
105
+ python -m pip install --upgrade pip poetry
106
+
107
+ - name : Install build dependencies & build
108
+ run : |
109
+ poetry install --no-interaction --no-root
110
+ poetry build
111
+
112
+ - name : Check dist contents
113
+ run : ls -la dist/
114
+
115
+ - name : Upload artifacts
116
+ uses : actions/upload-artifact@v4
117
+ with :
118
+ name : dist-packages
119
+ path : dist/
0 commit comments