-
Notifications
You must be signed in to change notification settings - Fork 9
109 lines (91 loc) · 3.62 KB
/
ci-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
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
name: Build with ESP-IDF
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.clang-format'
- '.gitignore'
pull_request:
branches: [master]
paths-ignore:
- '**.md'
- '.clang-format'
- '.gitignore'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo + submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build with ESP-IDF
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v4.4.4
target: esp32
- name: Upload build to artifact
uses: actions/upload-artifact@v3
with:
name: build
path: |
build/MCH2022.bin
build/MCH2022.elf
build/bootloader/bootloader.bin
build/bootloader/bootloader.elf
- name: Generate build report
env:
base_branch: master
current_ref: ${{ github.ref_name }}
compare_url_template: ${{ format('/{0}/compare/{{base}}...{{head}}', github.repository) }}
commit_hash: ${{ github.event.after }}
head_compare_url: ${{ github.event.compare }}
new_commits_json: ${{ toJSON(github.event.commits) }}
run: |
build_size_main=$(du build/MCH2022.bin | awk '{ print $1 }')
ref_compare_url=$(sed "s/{base}/$base_branch/; s/{head}/$commit_hash/" <<< $compare_url_template)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
cat << $EOF >> $GITHUB_STEP_SUMMARY
# Build summary 🔨${{ github.ref_name != 'master' && '🚧' || '' }}
**Source:** ${{ github.ref_type }} \`$current_ref\` -> [${{ github.repository }}@\`${commit_hash:0:7}\`](${{ github.event.head_commit.url }})
**Size of \`MCH2022.bin\`:** $build_size_main kB
\`\`\`console
\$ du -h build/*.bin build/*/*.bin
$(du -h build/*.bin build/*/*.bin)
\`\`\`
## Build details
**Build trigger:** ${{ github.event.forced && '☢️ forced' || '' }} ${{ github.event_name }} \`${{ github.event.ref }}\`
### Source
**HEAD:** [${{ github.repository }}@\`${commit_hash:0:7}\`](${{ github.event.head_commit.url }}) on ${{ github.ref_type }} [$current_ref]($ref_compare_url)
**Diff with previous HEAD:** $head_compare_url
#### New commits
$(jq -r 'map([
"**Commit [`\(.id[0:7])`](\(.url)) by \(if .author.username then "@"+.author.username else .author.name end):**",
.message,
(if .committer.name != .author.name then "\n> <sub>**Committer:** \(.committer.name) <\(.committer.email)></sub>" else "" end),
"<sub>**Timestamp:** \(.timestamp)</sub>"
] | map("> \(.)\n") | join("")) | join("\n")' <<< $new_commits_json)
#### Submodules
\`\`\`
$(
git submodule --quiet foreach '
branch=$(grep -C1 "$(git config --get remote.origin.url)" $toplevel/.gitmodules | grep "branch =" | rev | cut -d" " -f1 | rev)
git fetch origin $branch --unshallow >&2
commits_behind=$(git --no-pager log --oneline HEAD..origin/$branch)
[ -n "$commits_behind" ] && echo "$name has new commits upstream:\n$commits_behind" >&2
echo \
"$path\t" \
"$branch\t" \
"$(git rev-parse --short HEAD)\t" \
$(if [ -z "$commits_behind" ];
then echo "✅ up to date";
else echo "⚠️ $(echo "$commits_behind" | wc -l) commits behind origin/$branch";
fi)
' | column -t -s $'\t'
)
\`\`\`
$EOF
continue-on-error: true