Repository navigation
104 lines (102 loc) · 3.42 KB
/
Copy pathtests.yml
File metadata and controls
104 lines (102 loc) · 3.42 KB
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
name: Tests
on:
pull_request:
branches: [ develop, 'feature/**' ]
push:
branches: [ develop, 'feature/**' ]
jobs:
test:
strategy:
matrix:
go-version: [stable]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
cache: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go environment
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test Go linting (gofmt)
if: startsWith(matrix.os, 'ubuntu') == true
# https://olegk.dev/github-actions-and-go
run: gofmt -s -w . && git diff --exit-code
- name: Add extra loopback addresses
# macOS only has 127.0.0.1 on lo0, the smtpd tests connect from 127.0.0.2 and 127.0.0.3
if: startsWith(matrix.os, 'macos') == true
run: |
sudo ifconfig lo0 alias 127.0.0.2 up
sudo ifconfig lo0 alias 127.0.0.3 up
- name: Run Go tests
# use bash on all platforms: PowerShell (Windows default) does not support "\" line continuation
shell: bash
run: |
go test -p 1 \
./cmd \
./config \
./internal/auth \
./internal/connlimit \
./internal/dump \
./internal/healthcheck \
./internal/html2text \
./internal/htmlcheck \
./internal/linkcheck \
./internal/logger \
./internal/mimeparser \
./internal/pop3 \
./internal/prometheus \
./internal/rspamd \
./internal/shortuuid \
./internal/smtpd \
./internal/smtpd/chaos \
./internal/snakeoil \
./internal/spamassassin \
./internal/spamassassin/spamc \
./internal/spamassassin/postmark \
./internal/stats \
./internal/storage \
./internal/thumbnail \
./internal/tools \
./server \
./server/apiv1 \
./server/handlers \
./server/websockets \
-v
- name: Run Go benchmarking
run: go test -p 1 ./internal/storage ./internal/html2text -bench=.
# build the assets
- name: Set up node environment
if: startsWith(matrix.os, 'ubuntu') == true
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- name: Install JavaScript dependencies
if: startsWith(matrix.os, 'ubuntu') == true
run: npm ci
- name: Run JavaScript linting
if: startsWith(matrix.os, 'ubuntu') == true
run: npm run lint
- name: Run JavaScript tests
if: startsWith(matrix.os, 'ubuntu') == true
run: npm test
- name: Test JavaScript packaging
if: startsWith(matrix.os, 'ubuntu') == true
run: npm run package
# # validate the swagger file
# - name: Validate OpenAPI definition
# if: startsWith(matrix.os, 'ubuntu') == true
# uses: swaggerexpert/swagger-editor-validate@v1
# with:
# definition-file: server/ui/api/v1/swagger.json
# default-timeout: 20000