Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update backend to bca33b1 #2103

Merged
merged 31 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 6 additions & 33 deletions .github/workflows/experiments-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,20 @@ on:
paths:
- "packages/experiments/**"
- ".github/workflows/experiments-deploy.yml"
pull_request:
branches:
- main
paths:
- "packages/experiments/**"
- ".github/workflows/experiments-deploy.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
experiments-deploy-pages:
experiments-deploy-production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: "npm"

- name: Install dependencies
Expand All @@ -38,31 +32,10 @@ jobs:
GA_TRACKING_ID: "G-PPE5XD2VKV"

- name: Deploy production build
uses: cloudflare/wrangler-action@2.0.0
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
workingDirectory: "packages/experiments/"
command: pages publish ".svelte-kit/cloudflare" --branch=${{ github.head_ref }} --project-name=hot-or-not-experiments --commit-dirty=true
command: pages deploy ".svelte-kit/cloudflare" --branch=${{ github.head_ref }} --project-name=hot-or-not-experiments --commit-dirty=true
env:
CLOUDFLARE_ACCOUNT_ID: "a209c523d2d9646cc56227dbe6ce3ede"
- name: Get preview deployment URL
id: preview-url
working-directory: "packages/experiments/"
run: |
echo "url=$(grep -o 'http[s]*://[^\\]*' url.txt)" >> $GITHUB_OUTPUT

comment-on-pr:
name: Add a comment with the deployment link on the PR
if: github.actor != 'dependabot[bot]'
needs: ["experiments-deploy-pages"]
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Experiments preview build: ${{ needs.experiments-deploy-pages.outputs.previewUrl }}'
})
78 changes: 78 additions & 0 deletions .github/workflows/experiments-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Test experiments app
on:
pull_request:
branches:
- main
paths:
- "packages/experiments/**"
- ".github/workflows/experiments-test.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
experiments-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install dependencies
shell: bash
run: npm install

- name: Running svelte-check
run: npm run ex:check

- name: Building static version
run: npm run ex:build:static
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
GA_TRACKING_ID: "G-PPE5XD2VKV"

experiments-deploy-staging:
needs: ["experiments-test"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install dependencies
shell: bash
run: npm install

- name: Creating static build
run: npm run ex:build:static
env:
GA_TRACKING_ID: "G-PPE5XD2VKV"

- name: Deploying build
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
workingDirectory: "packages/experiments/"
command: pages deploy "./build" --branch=${{ github.head_ref }} --project-name=hot-or-not-experiments --commit-dirty=true
env:
CLOUDFLARE_ACCOUNT_ID: "a209c523d2d9646cc56227dbe6ce3ede"

- name: Comment preview link on PR
if: github.actor != 'dependabot[bot]'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Experiments preview build: ${{ steps.deploy.outputs.previewUrl }}'
})
38 changes: 25 additions & 13 deletions .github/workflows/webclient-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,37 @@ concurrency:
cancel-in-progress: true

jobs:
web-client-deploy-pages:
web-client-deploy-ic-production:
runs-on: ubuntu-latest
steps:
- name: Output of github.ref_name
run: echo ${{ github.ref_name }}
- uses: actions/checkout@v3
with:
submodules: "true"
- uses: actions/checkout@v4
- name: Set-up env
uses: ./.github/workflows/webclient-setup
- run: npm run wc:build:static:prod
# Build without sentry
- run: |
set -euxo pipefail
DFX_VERSION=0.13.1 sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"
- run: dfx identity list
- run: |
touch actions_identity.pem
echo "${{ secrets.CANISTER_CONTROLLER_SECRET_KEY }}" > actions_identity.pem
dfx identity import --disable-encryption actions actions_identity.pem
rm actions_identity.pem
dfx identity use actions
- run: dfx deploy webclient --network ic --no-wallet -y

web-client-deploy-fly-production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set-up env
uses: ./.github/workflows/webclient-setup
- run: npm run wc:build:prod
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy production build
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
workingDirectory: "packages/web-client/"
command: pages publish ".svelte-kit/cloudflare" --branch=main --project-name=hot-or-not-web-client --commit-dirty=true
run: flyctl deploy --config ./wc.prod.fly.toml
env:
CLOUDFLARE_ACCOUNT_ID: "a209c523d2d9646cc56227dbe6ce3ede"
FLY_API_TOKEN: ${{ secrets.FLYIO_KIT_DEPLOY_GH_ACTION }}
11 changes: 2 additions & 9 deletions .github/workflows/webclient-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ inputs:
runs:
using: composite
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: "npm"

- name: Install dependencies
Expand All @@ -29,12 +29,5 @@ runs:
working-directory: ${{ inputs.working-dir }}
env:
GA_TRACKING_ID: "G-S9P26021F9"
FIREBASE_API_KEY: "AIzaSyAeTkffJlMN3pnzU4sBzxwo6NCl4giaOTY"
FIREBASE_AUTH_DOMAIN: "hot-or-not-5d8ad.firebaseapp.com"
FIREBASE_PROJECT_ID: "hot-or-not-5d8ad"
FIREBASE_STORAGE_BUCKET: "hot-or-not-5d8ad.appspot.com"
FIREBASE_MESSAGING_SENDER_ID: "442139438721"
FIREBASE_APP_ID: "1:442139438721:web:b7e616f50feaa67ad12780"
FIREBASE_MEASUREMENT_ID: "G-LDBZXMYM4E"
CLOUDFLARE_WORKERS_API_HOST: "https://hot-or-not-upload-api-main.go-bazzinga.workers.dev"
WEBCLIENT_CANISTER_ID: "vyatz-hqaaa-aaaam-qauea-cai"
94 changes: 27 additions & 67 deletions .github/workflows/webclient-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,91 +25,51 @@ jobs:
timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- name: Output of github.ref_name
run: echo ${{ github.ref_name }}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "npm"
- name: Install dependencies & build
run: npm i
- name: Run sync
run: npm run wc:sync
- run: npm install
- name: Run svelte-check
run: npm run wc:check

deploy-preview:
web-client-deploy-fly-staging:
needs: ["svelte-check"]
if: github.event.pull_request.draft == false
environment:
name: pr-${{ github.event.number }}
url: ${{ steps.deploy.outputs.url }}
runs-on: ubuntu-latest
outputs:
previewUrl: ${{ steps.preview-url.outputs.url }}
steps:
- uses: actions/checkout@v3
with:
submodules: "true"
- uses: actions/checkout@v4

- name: Set-up env
uses: ./.github/workflows/webclient-setup
- run: npm run wc:build

- name: Deploy preview build
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
workingDirectory: "packages/web-client/"
command: pages publish ".svelte-kit/cloudflare" --branch=${{ github.head_ref }} --project-name=hot-or-not-web-client --commit-dirty=true | tee url.txt
env:
CLOUDFLARE_ACCOUNT_ID: "a209c523d2d9646cc56227dbe6ce3ede"
- name: Get preview deployment URL
id: preview-url
working-directory: "packages/web-client/"
run: |
echo "url=$(grep -o 'http[s]*://[^\\]*' url.txt)" >> $GITHUB_OUTPUT
- run: npm run wc:build:prod

comment-on-pr:
name: Add a comment with the deployment link on the PR
if: github.actor != 'dependabot[bot]'
needs: ["deploy-preview"]
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Deployed on Cloudflare pages: ${{ needs.deploy-preview.outputs.previewUrl }}'
})

google-chat-webhook:
name: Send URL to Google chat workspace
if: github.actor != 'dependabot[bot]'
needs: ["deploy-preview"]
runs-on: ubuntu-latest
steps:
- name: Send deployment URL to Google Chat
uses: fjogeleit/[email protected]
- name: Deploy staging build
id: deploy
uses: superfly/[email protected]
env:
FLY_API_TOKEN: ${{ secrets.FLYIO_KIT_DEPLOY_GH_ACTION }}
FLY_ORG: gobazzinga-inc-584
with:
url: "https://chat.googleapis.com/v1/spaces/AAAAAfsrp8U/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=_QvV-c8ZdTVTzGZxXW_PdR_o-0HI8VhO3I9dMAp6zls%3D"
method: "POST"
customHeaders: '{"Content-Type": "application/json"}'
data: '{"text": "PR: \"${{ github.event.pull_request.title }}\" deployed at: \n ${{ needs.deploy-preview.outputs.previewUrl }}"}'
config: "wc.staging.fly.toml"

tests-lighthouse-reports:
needs: ["svelte-check"]
if: github.event.pull_request.draft == false
timeout-minutes: 40
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: "true"

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "npm"

- name: Install dependencies
Expand All @@ -122,10 +82,10 @@ jobs:
run: rustup target add wasm32-unknown-unknown

- name: Install DFX
run: DFX_VERSION=0.13.1 sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"
run: DFX_VERSION=0.16.1 sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"

- name: Cache rust dependencies, build output and DFX build cache
uses: actions/cache@v3
uses: actions/cache@v4
id: dfx-cache
with:
path: |
Expand Down Expand Up @@ -193,28 +153,28 @@ jobs:
run: dfx stop
if: always()

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-ci-report
path: lhci_report
retention-days: 7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: packages/web-client/coverage/
retention-days: 7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-report
path: packages/web-client/cypress/
retention-days: 7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-report
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/workers-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
workers-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "npm"
- run: cd packages/workers && npm install
- uses: cloudflare/wrangler-action@2.0.0
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_DEPLOY_API_TOKEN }}
environment: "main"
Expand Down
Loading
Loading