Skip to content

Commit

Permalink
ci: add build-and-deploy-stg to create staging env for integration & …
Browse files Browse the repository at this point in the history
…load test
  • Loading branch information
ngshiheng committed May 18, 2022
1 parent 5c616a9 commit 6c1671e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ name: CI
jobs:
lint:
uses: ./.github/workflows/lint.yml
build-and-deploy:
build-and-deploy-stg:
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -20,13 +22,25 @@ jobs:
env:
CI: true
- uses: cloudflare/[email protected]
name: Deploy to Cloudflare
name: Deploy to Cloudflare (Staging)
with:
apiToken: "${{ secrets.CF_API_TOKEN }}"
environment: "staging"
k6-load-test:
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- build-and-deploy-stg
steps:
- uses: actions/checkout@v3
- uses: grafana/[email protected]
name: Run k6 local test
with:
filename: scripts/test.js
semantic-release:
runs-on: ubuntu-latest
needs:
- build-and-deploy
- k6-load-test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -35,18 +49,26 @@ jobs:
cache: npm
- run: npm ci
- run: npx semantic-release
name: Semantic Release
name: Run Semantic Release
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
load-test:
build-and-deploy-prd:
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- build-and-deploy
- k6-load-test
steps:
- uses: actions/checkout@v3
- uses: grafana/[email protected]
name: Run k6 test
- uses: actions/setup-node@v3
with:
filename: scripts/test.js
node-version: lts/*
cache: npm
- run: npm ci
- run: npm run build --if-present
env:
CI: true
- uses: cloudflare/[email protected]
name: Deploy to Cloudflare (Production)
with:
apiToken: "${{ secrets.CF_API_TOKEN }}"
environment: "production"
2 changes: 1 addition & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const options = {

let shortenLink

const BASE_URL = 'https://s.jerrynsh.com'
const BASE_URL = 'https://atomic-url-staging.jerrynsh.workers.dev/'
const DUMMY_ORIGINAL_URL = 'https://jerrynsh.com/i-built-my-own-tiny-url/'

export default function () {
Expand Down

0 comments on commit 6c1671e

Please sign in to comment.