-
Notifications
You must be signed in to change notification settings - Fork 52
146 lines (120 loc) · 4 KB
/
dailyMultiOS.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
145
146
name: Daily Multi-OS Job
on:
schedule:
- cron: '0 2,8,14,20 * * *' # Runs at 2 AM, 8 AM, 2 PM, and 8 PM UTC every day
workflow_dispatch: # Allows manual triggering
jobs:
local_runners:
if: github.repository == 'Protofy-xyz/Protofy'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, macos-13, macos-12] # missing: windows-latest
fail-fast: false # Allow other jobs to continue if one fails
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.4'
cache: 'yarn'
- name: Health check versions
run: |
node -v
yarn -v
- name: Install NodeJS dependencies
run: yarn
- name: Start project
run: |
echo 'Started project'
yarn dev > /dev/null &
- name: Healthcheck services start
run: node .github/scripts/healthcheck-start.js
- name: Run Global tests
run: yarn test:global
- name: Save result
if: always()
run: node .github/scripts/save_result.js ${{ matrix.os }} ${{ job.status }} ${{ runner.temp }}
- name: Upload result # upload saved result as artifact to be consumed at notify job
uses: actions/upload-artifact@v3
with:
name: result-${{ matrix.os }}
path: ${{ runner.temp }}/result.txt
docker_runners:
if: github.repository == 'Protofy-xyz/Protofy'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Healthcheck versions
run: |
docker -v
docker compose version
docker-compose -v
id
groups
- name: Prepare Docker Volumes
run: |
cd docker
./init
- name: Build Image
run: |
cd docker
./build
- name: Start Docker project in Development and background
run: |
cd docker
source ./helpers/get-envs
$DOCKER_COMPOSE_CMD -p protofy $SERVICES_COMPOSE_FILES up -d
- name: Services logs
if: false # skip by deault enable for debugging purposes
run: |
cd docker
./logs
- name: Healthcheck docker services start
run: node .github/scripts/healthcheck-start.js
- name: Run global tests
run: docker exec -i site sh -c "yarn test:global"
- name: Save result
if: always()
run: node .github/scripts/save_result.js Docker_DEV ${{ job.status }} ${{ runner.temp }}
- name: Upload result # upload saved result as artifact to be consumed at notify job
uses: actions/upload-artifact@v3
with:
name: result-Docker_DEV
path: ${{ runner.temp }}/result.txt
notify:
runs-on: ubuntu-latest
needs: [local_runners, docker_runners]
if: always() && github.repository == 'Protofy-xyz/Protofy' # This ensures that the notification job runs whether the build job succeeds or fails
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Combine results
run: |
for result_dir in result-*; do
if [ -d "$result_dir" ]; then
cat "$result_dir/result.txt" >> combined_results.txt
fi
done
echo "Combined results result:"
echo "RESULTS<<EOF" >> $GITHUB_ENV
cat combined_results.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Daily build Report
uses: rjstone/discord-webhook-notify@v1
env:
RESULTS: ${{ env.RESULTS }}
with:
severity: info
color: '#a600e0'
avatarUrl: https://raw.githubusercontent.com/Protofy-xyz/Protofy/assets/protofito_purple.png
description: |
Daily OS Build Report 👀
${{ env.RESULTS }}
footer: Daily report.
text: 🚨 Check daily report! 🚨
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}