-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (57 loc) · 2.67 KB
/
build.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
name: Build
on:
push:
branches:
- dev
- main
- master
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
container: docker://helife/epilight
steps:
- uses: actions/checkout@v2
- name: Build
shell: bash
run: "make 2>&1 | tee build_output"
- name: Send notification
shell: bash
if: ${{ github.event_name == 'push' && always() }}
run: |
checkout=$(git log -1 --pretty=format:"*Checkout:%d: %h %s*")
errors=$(bash -c 'cat build_output | grep "error: " -A 2 | python3 -c "import json,sys; print(json.dumps(sys.stdin.read())[1:-1])"')
if [[ -z $errors ]]; then
errors="No errors."
fi
errors_count=$(bash -c 'cat build_output | grep "error: " | wc -l')
echo '{"content": "**'$GITHUB_REPOSITORY'**\n'$checkout'\nCompilation: '$errors_count' errors.\n```\n'$errors'\n```"}' > notification_data
cat notification_data
curl --data "$(cat notification_data)" --header "Content-Type: application/json" https://discord.com/api/webhooks/836673978596065310/seRSxn9ifMj9i5KaKDetuuZaleXUMW-kRmIiuusIxtRmHEs-gyBaws5_A1Tg2oobQ0qK
- uses: actions/upload-artifact@v2
with:
name: build_output
path: build_output
- name: Preparing a clean env
run: make fclean
- name: Build with debug mode
if: always()
shell: bash
run: "EPIDEBUG=1 make 2>&1 | tee build_output_debug"
- name: Send notification
shell: bash
if: ${{ github.event_name == 'push' && always() }}
run: |
checkout=$(git log -1 --pretty=format:"*Checkout:%d: %h %s*")
warnings=$(bash -c 'cat build_output_debug | grep "warning: " -A 2 | python3 -c "import json,sys; print(json.dumps(sys.stdin.read())[1:-1])"')
if [[ -z $warnings ]]; then
warnings="No warnings."
fi
warnings_count=$(bash -c 'cat build_output_debug | grep "warning: " | wc -l')
echo '{"content": "**'$GITHUB_REPOSITORY'**\n'$checkout'\nDebug compilation: '$warnings_count' warnings.\n```\n'$warnings'\n```"}' > notification_data
cat notification_data
curl --data "$(cat notification_data)" --header "Content-Type: application/json" https://discord.com/api/webhooks/836673978596065310/seRSxn9ifMj9i5KaKDetuuZaleXUMW-kRmIiuusIxtRmHEs-gyBaws5_A1Tg2oobQ0qK
- uses: actions/upload-artifact@v2
with:
name: build_output_debug
path: build_output_debug