Skip to content

Curl Regression

Curl Regression #772

# 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