Skip to content

Commit

Permalink
Merge pull request #600 from dzcode-io/hourly-metrics
Browse files Browse the repository at this point in the history
feat: Hourly metrics
  • Loading branch information
ZibanPirate authored Sep 18, 2024
2 parents e0a9d1a + 6a84afc commit b1b5fe9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ template: |
To test on `stage` environment go to:
- [stage.dzcode.io](https://stage.dzcode.io)
- [Android](https://play.google.com/store/apps/details?id=io.dzcode.mobile)
- [iOS](https://testflight.apple.com/join/XDcfIqdJ)
- [Expo](https://expo.dev/@zakman.dev/dzcode?release-channel=stage)
autolabeler:
- label: "breaking-change"
body:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/cd.deploy.stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
tags:
- "stg-v*"
# @TODO-ZM: remove this
branches:
- "lighthouse-setup"
workflow_dispatch:

jobs:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ci.hourly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Hourly Job"

on:
schedule:
- cron: "0 * * * *" # every hour

jobs:
build:
uses: ./.github/workflows/ci.reusable.build.yml
with:
node-version: "20"
os: "ubuntu-latest"

lighthouse-stg:
needs: build
uses: ./.github/workflows/ci.reusable.lighthouse.yml
with:
serverBaseUrl: "https://lh-stage.dzcode.io"
testBaseUrl: "https://stage.dzcode.io"
stage: "staging"
secrets:
LH_SERVER_TOKEN_STG: ${{ secrets.LH_SERVER_TOKEN_STG }}
LH_SERVER_TOKEN_PRD: ${{ secrets.LH_SERVER_TOKEN_PRD }}

lighthouse-prd:
needs: build
uses: ./.github/workflows/ci.reusable.lighthouse.yml
with:
serverBaseUrl: "https://lh.dzcode.io"
testBaseUrl: "https://dzcode.io"
stage: "production"
secrets:
LH_SERVER_TOKEN_STG: ${{ secrets.LH_SERVER_TOKEN_STG }}
LH_SERVER_TOKEN_PRD: ${{ secrets.LH_SERVER_TOKEN_PRD }}
12 changes: 10 additions & 2 deletions .github/workflows/ci.reusable.lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lighthouse output (${{ hashFiles('web/.lighthouseci/**') }})
name: lighthouse-${{inputs.stage}} output (${{ hashFiles('web/.lighthouseci/**') }})
path: ./web/.lighthouseci/**
if-no-files-found: error
include-hidden-files: true
Expand All @@ -81,6 +81,12 @@ jobs:
env:
LH_SERVER_BASE_URL: ${{ inputs.serverBaseUrl }}
LH_SERVER_TOKEN: ${{ inputs.stage == 'staging' && secrets.LH_SERVER_TOKEN_STG || secrets.LH_SERVER_TOKEN_PRD }}
# LHCI_BUILD_CONTEXT__COMMIT_TIME is set in "Get current time" step
LHCI_BUILD_CONTEXT__AVATAR_URL: "https://avatars.githubusercontent.com/u/63493121?s=200&v=4"
LHCI_BUILD_CONTEXT__AUTHOR: "dzcode-io"
LHCI_BUILD_CONTEXT__CURRENT_BRANCH: "main"
LHCI_BUILD_CONTEXT__COMMIT_MESSAGE: "Automated Lighthouse CI"
LHCI_BUILD_CONTEXT__CURRENT_HASH: "run-${{ github.run_id }}-${{ github.run_number }}"
steps:
- name: "Git"
uses: actions/checkout@v4
Expand All @@ -97,7 +103,9 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: lighthouse*
pattern: lighthouse-${{inputs.stage}}*
merge-multiple: true
path: ./web/.lighthouseci
- name: "Get current time"
run: echo "LHCI_BUILD_CONTEXT__COMMIT_TIME=$(date '+%Y-%m-%d %H:%M:%S %z')" >> $GITHUB_ENV
- run: npx lerna run lh:upload --scope "@dzcode.io/web"

0 comments on commit b1b5fe9

Please sign in to comment.