-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (68 loc) · 2.52 KB
/
deploy-app-farm.yaml
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
name: Build and Run Application on Linux (Farm)
on:
workflow_dispatch:
env:
VM_MEMORY: 8192
VM_CPU: 6
VM_IMAGE: UBUNTU
jobs:
run:
runs-on: farm
timeout-minutes: 40
env:
CONNECTION_STRING: MySqlConnectionString
steps:
- name: Get ip
run: echo "LOCAL_IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')" >> $GITHUB_ENV
- name: Show IP
run: echo ${{ env.LOCAL_IP_ADDRESS }}
- name: Checkout
uses: ./../../checkout
- name: Use Node.js
run: |
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install nodejs
- name: Set up MySql
run: |
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo apt update
sudo apt install -y mysql-server
sudo mysql -e "CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'qwerty1'; GRANT ALL PRIVILEGES ON *.* TO testuser@localhost; FLUSH PRIVILEGES;"
- name: Set npm registry
run: npm config set registry https://registry.npmjs.org/
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Add DevExpress NuGet Package Source
continue-on-error: true
run: dotnet nuget add source ${{ secrets.DEVEXPRESS_NUGET_URL }} -n devexpress-nuget
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Update database
run: dotnet run --project LoadTestingApp.Blazor.Server --updateDatabase --forceUpdate --silent
- name: Track memory usage
run: while true; do free >> memory.log; sleep 10; done &
- name: Track CPU usage
run: while true; do ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> cpu.log; sleep 10; done &
- name: Run application
run: dotnet run --project LoadTestingApp.Blazor.Server &
- name: Run tests
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: Load Testing (Farm)
token: ${{ secrets.PERSONAL_TOKEN }}
wait-for-completion: true
inputs: '{ "appUrl": "${{ env.LOCAL_IP_ADDRESS }}:5002" }'
- name: Show CPU usage
if: ${{ always() }}
run: cat cpu.log
- name: Show memory usage
if: ${{ always() }}
run: cat memory.log