mirror of
https://github.com/axllent/mailpit.git
synced 2026-06-28 06:56:06 +00:00
61 lines
2.1 KiB
YAML
61 lines
2.1 KiB
YAML
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@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
cache: false
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: Set up Go environment
|
|
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
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: Run Go tests
|
|
run: go test -p 1 ./internal/storage ./server ./internal/smtpd ./internal/pop3 ./internal/tools ./internal/html2text ./internal/htmlcheck ./internal/linkcheck ./internal/shortuuid -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@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.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: 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
|