| name: Calculate ICFY stats | |
| on: [push] | |
| jobs: | |
| build: | |
| name: Build ICFY stats | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=4096 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Fetch git history | |
| run: git fetch --prune --unshallow | |
| - name: Install dependencies | |
| run: SKIP_TSC=true yarn install --inline-builds | |
| - name: Build ICFY stats | |
| env: | |
| NODE_ENV: production | |
| BROWSERSLIST_ENV: defaults | |
| WORKERS: 2 | |
| run: yarn run analyze-icfy | |
| - run: mkdir icfy-stats && mv client/{chart,stats}.json icfy-stats | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: icfy | |
| path: icfy-stats | |
| retention-days: 7 | |
| - name: Upload build artifact | |
| env: | |
| ICFY_SECRET: ${{ secrets.ICFY_SECRET }} | |
| run: | | |
| ANCESTOR_SHA1=$(git merge-base HEAD origin/trunk) | |
| CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| curl -X POST --globoff \ | |
| "http://iscalypsofastyet.com/submit-stats?from=github&secret=$ICFY_SECRET" \ | |
| -H 'Cache-Control: no-cache' \ | |
| -H 'Content-Type: application/json' \ | |
| -d '{ | |
| "payload": { | |
| "branch": "'"$CURRENT_BRANCH"'", | |
| "build_num": '"$GITHUB_RUN_ID"', | |
| "sha": "'"$GITHUB_SHA"'", | |
| "ancestor": "'"$ANCESTOR_SHA1"'" | |
| } | |
| }' | |