-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (137 loc) · 3.93 KB
/
validate.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
138
139
140
141
142
143
144
name: Validate
on:
push:
paths:
- "python/**"
- "cli/**"
- ".github/workflows/validate.yml"
- ".github/workflows/release.yml"
jobs:
lint-sdk:
name: Lint python SDK
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install .[dev]
- run: python -m ruff check ./python
- run: python -m mypy --strict ./python
test-sdk:
name: Unit test python SDK
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -e .[dev]
- run: coverage run -m pytest -vv ./python/tests/
- run: coverage report | grep 'TOTAL' | awk '{print $4}' > ./sdk-coverage.txt
- uses: actions/upload-artifact@v4
with:
name: sdk-coverage
path: ./sdk-coverage.txt
build:
timeout-minutes: 15
runs-on: ubuntu-latest
name: Build package
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- run: python3 -m pip install python-semantic-release==9.6.0 build>=1.2.1
- run: semantic-release version --no-commit --no-tag --no-push --no-changelog # update version locally to build new version
- run: make package
- uses: actions/upload-artifact@v4
with:
name: package
path: ./dist/*
test-cli-windows:
name: Test CLI on windows
runs-on: windows-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- uses: actions/download-artifact@v4
id: download
with:
name: package
path: ./dist
- run: cmd /r dir /b /a-d dist > files.txt
- run: |
$files = Get-Content files.txt
foreach ($file in $files) {
pip install dist/$file
}
- run: numerous --help
lint-cli:
name: Lint CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: Lint (golangci-lint)
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.2
working-directory: cli
args: --config=../.golangci.yml --verbose
- name: Install gofumpt
shell: bash
run: |
wget https://github.com/mvdan/gofumpt/releases/download/v0.6.0/gofumpt_v0.6.0_linux_amd64
mv gofumpt_v0.6.0_linux_amd64 gofumpt
chmod +x gofumpt
mv gofumpt /usr/local/bin
- name: Check gofumpt formatting
shell: bash
run: |
unformatted_files=$(gofumpt -l .)
if [[ "$unformatted_files" != "" ]]; then
echo "Some files do not adhere to gofumpt formatting:"
echo "$unformatted_files"
exit 1
fi
test-cli:
name: Unit test CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
- name: Tests
working-directory: cli
run: go test -coverprofile=c.out ./...
- name: Extract Test Coverage Percentage
working-directory: cli
run: go tool cover -func c.out | fgrep total | awk '{print $3}' > ./cli-coverage.txt
- uses: actions/upload-artifact@v4
with:
name: cli-coverage
path: cli/cli-coverage.txt