-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (169 loc) · 6.44 KB
/
curl-regression.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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Git clone based workflow regression where the command executed is ./initialize.sh
# .github/workflows/curl-regression.yaml
name: Curl Regression
on:
workflow_dispatch:
schedule:
- cron: '0 0/24 * * *' # https://crontab.cronhub.io/
jobs:
macos_build:
name: Build test
runs-on: macos-latest
outputs:
script_start_time: ${{ steps.pre-script.outputs.start_time }}
script_end_time: ${{ steps.post-script.outputs.end_time }}
disk_before: ${{ steps.disk-stats-before-script.outputs.before_disk_space }}
disk_after: ${{ steps.disk-stats-after-script.outputs.after_disk_space }}
strategy:
fail-fast: false
matrix:
node_version:
- 16
system:
- os: [self-hosted, macOS, ARM64]
target: aarch64-apple-darwin
steps:
- name: Set env
id: set-env
run: echo "CI=true" >> $GITHUB_ENV
- name: Install Bash 4, asdf and GNU sed on Mac
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install bash
brew install gnu-sed
brew install asdf
echo "/usr/local/bin" >> $GITHUB_PATH
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Install chrome and vscode
run: |
brew install vim
brew tap homebrew/cask
brew tap homebrew/cask-versions
brew install --cask google-chrome
brew install --cask visual-studio-code
- name: Display the architecture
shell: bash
run: |
arch
- name: Check the CI environment variable
shell: bash
run: |
[[ -z "${CI}" ]] && echo "Not running on CI" || echo "Running on CI"
# - name: Cache brew deps
# uses: actions/cache@v2
# with:
# # Paths to cache:
# # /usr/local/Homebrew - installation folder of Homebrew
# # /usr/local/Cellar - installation folder of Homebrew formulae
# # /usr/local/Frameworks, /usr/local/bin, /usr/local/opt - contain (links to) binaries installed by Homebrew formulae
# # /usr/local/lib/python3.8 - Python3 packages installation
# path: |
# /usr/local/Homebrew
# /usr/local/Cellar
# /usr/local/Frameworks
# /usr/local/bin
# /usr/local/opt
# /usr/local/lib/python3.8
# /opt/homebrew/
# key: macos-build-cache-${{ hashFiles('./setup.sh') }}
- name: Check disk stats before running the script
id: disk-stats-before-script
shell: bash
run: |
BEFORE_DISK_SPACE=$(diskutil info /dev/disk1s1 | awk '/Container Free Space:.* GB/ {print $4}')
echo "$BEFORE_DISK_SPACE GB"
echo "##[set-output name=before_disk_space;]$BEFORE_DISK_SPACE"
- name: Check the script start time
id: pre-script
run: |
DATE_TIMESTAMP=$(date -u +%s)
echo "##[set-output name=start_time;]$DATE_TIMESTAMP"
# - name: Cache Homebrew Packages
# id: cache-homebrew-packages
# uses: actions/[email protected]
# env:
# cache-name: homebrew-packages
# with:
# path: |
# /usr/local/Homebrew
# /usr/local/Cellar
# /usr/local/Frameworks
# /usr/local/bin
# /usr/local/opt
# /opt/homebrew/
# key: ${{ matrix.os }}-${{ env.cache-name }}-${{ hashFiles('./setup/brew.sh') }}
- name: Run the script
id: run-script
env:
RUN_SETUP: true
# RUN_SETUP_HOMEBREW: true
RUN_MAC_UPDATES: true
# RUN_SETUP_RN: true
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
bash -c "`curl -L https://git.io/dotfiles-m1`"
- name: Check the script end time
id: post-script
run: |
DATE_TIMESTAMP=$(date -u +%s)
echo "##[set-output name=end_time;]$DATE_TIMESTAMP"
- name: Check disk stats after running the script
id: disk-stats-after-script
shell: bash
run: |
AFTER_DISK_SPACE=$(diskutil info /dev/disk1s1 | awk '/Container Free Space:.* GB/ {print $4}')
echo "$AFTER_DISK_SPACE GB"
echo "##[set-output name=after_disk_space;]$AFTER_DISK_SPACE"
create-badge:
name: Create elapsed Badge
runs-on: ubuntu-latest
needs: macos_build
steps:
- id: elapsed
run: |
START_TIME=${{needs.macos_build.outputs.script_start_time}}
END_TIME=${{needs.macos_build.outputs.script_end_time}}
ELAPSE=$(expr $END_TIME - $START_TIME)
ELAPSE_HOURS=$(expr $ELAPSE / 3600)
ELAPSE_MINUTES=$(expr $ELAPSE / 60)
echo "##[set-output name=data;]${ELAPSE_MINUTES}m $(expr $ELAPSE % 60)s"
# echo "##[set-output name=data;]${ELAPSE_HOURS}h $(($ELAPSE_MINUTES - ($ELAPSE_HOURS * 60)))m $(expr $ELAPSE % 60)s"
- id: disk_occupied
run: |
sub() { n="$@"; bc <<< "${n// /-}"; }
BEFORE=${{needs.macos_build.outputs.disk_before}}
AFTER=${{needs.macos_build.outputs.disk_after}}
OCCUPIED="$(sub $BEFORE $AFTER)"
echo "##[set-output name=data;]~$OCCUPIED GB"
- id: last_reg_date
run: |
DATE=$(echo "$(date +'%Y-%m-%dT%H:%M:%S')")
echo "##[set-output name=data;]$DATE"
- name: Create the Badge
uses: schneegans/dynamic-badges-action@master
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ secrets.GIST_ID }}
filename: elapsed-curl-badge.json
label: 'runtime'
message: ${{ steps.elapsed.outputs.data }}
color: orange
- name: Create the regression date Badge
uses: schneegans/dynamic-badges-action@master
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ secrets.GIST_ID }}
filename: regression-date-badge.json
label: 'last regression'
message: ${{ steps.last_reg_date.outputs.data }}
color: F3C5C5
- name: Create the disk space occupied Badge
uses: schneegans/dynamic-badges-action@master
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: ${{ secrets.GIST_ID }}
filename: minimum-disk-space-occupied-badge.json
label: 'min. disk space'
message: ${{ steps.disk_occupied.outputs.data }}
color: DD4A48