-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (79 loc) · 2.77 KB
/
ci.yml
File metadata and controls
79 lines (79 loc) · 2.77 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
name: Web API / CI
on:
push:
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-22.04
env:
WEB_PROJECT_PATH: src/Buttercup.Web
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.1xx
dotnet-quality: ga
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: ${{env.WEB_PROJECT_PATH}}/package-lock.json
- name: Set SHORT_COMMIT_SHA
run: echo "SHORT_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Restore .NET tools
run: dotnet tool restore
- name: Restore Node.js dependencies
run: npm ci
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Build .NET solution
run: dotnet build --configuration Release /WarnAsError
- name: Build assets
run: npx gulp build
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Start MySQL Server
run: sudo systemctl start mysql.service
- name: Create MySQL user
run: mysql -uroot -proot < scripts/create-dev-user.sql
- name: Run .NET tests
run: dotnet test --no-build --configuration Release --collect "XPlat Code Coverage"
- name: Report .NET test coverage
if: ${{ hashFiles('**/coverage.cobertura.xml') }}
run: |
./scripts/build-dotnet-coverage-report.sh -reporttypes:TextSummary
cat coverage/Summary.txt
- name: Run Jest tests
run: npx jest --coverage
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Install Playwright browsers
run: npx playwright install --with-deps
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Run Playwright tests
run: npx playwright test
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Check formatting
run: npx prettier -c .
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Lint scripts
run: npx eslint .
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Lint styles
run: npx stylelint --max-warnings 0 styles/
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Publish
run: dotnet publish Buttercup.Web.csproj --no-build --no-restore --configuration Release --output publish-output
working-directory: ${{env.WEB_PROJECT_PATH}}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: buttercup-web-${{env.SHORT_COMMIT_SHA}}
path: ${{env.WEB_PROJECT_PATH}}/publish-output
retention-days: 3