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

chore: add dialtone vue2 #33

Merged
merged 5 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 60 additions & 7 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
pull-requests: read
outputs:
dialtone: ${{ steps.filter.outputs.dialtone }}
dialtone-vue-2: ${{ steps.filter.outputs.dialtone-vue-2 }}
dialtone-vue-3: ${{ steps.filter.outputs.dialtone-vue-3 }}
steps:
- name: Checkout
Expand All @@ -34,6 +35,8 @@ jobs:
dialtone:
- 'apps/dialtone-documentation/**'
- 'packages/**'
dialtone-vue-2:
- 'packages/**'
dialtone-vue-3:
- 'packages/**'

Expand All @@ -48,6 +51,7 @@ jobs:
env:
VUEPRESS_BASE_URL: /deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_BUCKET_DIRECTORY: dialtone.dialpad.com/deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_VUE_2_BUCKET_DIRECTORY: dialtone.dialpad.com/vue/deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_VUE_3_BUCKET_DIRECTORY: dialtone.dialpad.com/vue3/deploy-previews/pr-${{ github.event.pull_request.number }}/
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -81,14 +85,26 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# ---------- #
# Build docs #
# ---------- #

- name: Build Dialtone library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
run: pnpm nx run --verbose dialtone-documentation:build-docs

- name: Build Dialtone-vue 2 library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
run: pnpm nx run --verbose dialtone-vue2:build-docs

- name: Build Dialtone-vue 3 library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
run: pnpm nx run --verbose dialtone-vue3:build-docs

# --------- #
# Setup GCP #
# --------- #

- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
Expand All @@ -99,16 +115,29 @@ jobs:
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

# -------------- #
# Cleanup bucket #
# -------------- #

- name: Clean up bucket Dialtone
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_BUCKET_DIRECTORY) }}

- name: Clean up bucket Dialtone Vue 2
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_2_BUCKET_DIRECTORY) }}

- name: Clean up bucket Dialtone Vue 3
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_3_BUCKET_DIRECTORY) }}

# ---------- #
# GCP Upload #
# ---------- #

- name: Upload Dialtone to GCP
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
uses: google-github-actions/upload-cloud-storage@v1
Expand All @@ -117,6 +146,26 @@ jobs:
destination: ${{ env.DIALTONE_BUCKET_DIRECTORY }}
parent: false

- name: Upload Dialtone-vue 2 to GCP
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: packages/dialtone-vue2/storybook-static
destination: ${{ env.DIALTONE_VUE_2_BUCKET_DIRECTORY }}
parent: false

- name: Upload Dialtone-vue 3 to GCP
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: packages/dialtone-vue3/storybook-static
destination: ${{ env.DIALTONE_VUE_3_BUCKET_DIRECTORY }}
parent: false

# ------------- #
# Post messages #
# ------------- #

- name: Add Dialtone ready message
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
uses: mshick/add-pr-comment@v1
Expand All @@ -129,15 +178,19 @@ jobs:
😎 Browse the preview: https://${{ env.DIALTONE_BUCKET_DIRECTORY }}
allow-repeats: true

- name: Upload Dialtone-vue 3 to GCP
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
uses: google-github-actions/upload-cloud-storage@v1
- name: Add Dialtone-vue 2 ready message
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
uses: mshick/add-pr-comment@v1
env:
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: packages/dialtone-vue3/storybook-static
destination: ${{ env.DIALTONE_VUE_3_BUCKET_DIRECTORY }}
parent: false
message: |
✔️ Dialtone-vue 2 Deploy Preview ready!
😎 Browse the preview: https://${{ env.DIALTONE_VUE_2_BUCKET_DIRECTORY }}
allow-repeats: true

- name: Add Dialtone Vue 3 ready message
- name: Add Dialtone-vue 3 ready message
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
uses: mshick/add-pr-comment@v1
env:
Expand Down
48 changes: 45 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
dialtone: ${{ steps.filter.outputs.dialtone }}
dialtone-vue-2: ${{ steps.filter.outputs.dialtone-vue-2 }}
dialtone-vue-3: ${{ steps.filter.outputs.dialtone-vue-3 }}
steps:
- name: Checkout
Expand All @@ -40,6 +41,8 @@ jobs:
dialtone:
- 'apps/dialtone-documentation/**'
- 'packages/**'
dialtone-vue-2:
- 'packages/**'
dialtone-vue-3:
- 'packages/**'

Expand Down Expand Up @@ -72,6 +75,7 @@ jobs:
env:
VUEPRESS_BASE_URL: ${{ github.ref == 'refs/heads/production' && '/' || format('/{0}/', needs.get-branch-name.outputs.current_branch) }}
DIALTONE_BUCKET_DIRECTORY: dialtone.dialpad.com${{ github.ref == 'refs/heads/production' && '/' || format('/{0}/', needs.get-branch-name.outputs.current_branch) }}
DIALTONE_VUE_2_BUCKET_DIRECTORY: dialtone.dialpad.com/vue${{ github.ref == 'refs/heads/production' && '/' || format('/{0}/', needs.get-branch-name.outputs.current_branch) }}
DIALTONE_VUE_3_BUCKET_DIRECTORY: dialtone.dialpad.com/vue3${{ github.ref == 'refs/heads/production' && '/' || format('/{0}/', needs.get-branch-name.outputs.current_branch) }}
steps:
- name: Checkout
Expand Down Expand Up @@ -104,8 +108,16 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

# ---------- #
# Build docs #
# ---------- #

- name: Build documentation sites
run: pnpm nx run-many --verbose --target=build-docs --projects=dialtone-documentation,dialtone-vue3
run: pnpm nx run-many --verbose --target=build-docs --projects=dialtone-documentation,dialtone-vue2,dialtone-vue3

# --------- #
# Setup GCP #
# --------- #

- id: auth
name: Authenticate to Google Cloud
Expand All @@ -117,38 +129,68 @@ jobs:
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

# ------------------ #
# Cleanup production #
# ------------------ #

- name: Clean up bucket Dialtone
if: ${{ github.ref == 'refs/heads/production' }}
run: >
gcloud storage ls gs://dialtone.dialpad.com |
gcloud storage ls ${{ format('gs://{0}', env.DIALTONE_BUCKET_DIRECTORY) }} |
grep -v -E '/alpha/|/beta/|/legacy/|/next/|/deploy-previews/|/vue/|/vue3/|/staging/' |
gcloud storage rm --recursive --read-paths-from-stdin

- name: Clean up bucket Dialtone Vue 2
if: ${{ github.ref == 'refs/heads/production' }}
run: >
gcloud storage ls ${{ format('gs://{0}', env.DIALTONE_VUE_2_BUCKET_DIRECTORY) }} |
grep -v -E '/alpha/|/beta/|/legacy/|/next/|/deploy-previews/|/staging/' |
gcloud storage rm --recursive --read-paths-from-stdin

- name: Clean up bucket Dialtone Vue 3
if: ${{ github.ref == 'refs/heads/production' }}
run: >
gcloud storage ls gs://dialtone.dialpad.com/vue3 |
gcloud storage ls ${{ format('gs://{0}', env.DIALTONE_VUE_3_BUCKET_DIRECTORY) }} |
grep -v -E '/alpha/|/beta/|/legacy/|/next/|/deploy-previews/|/staging/' |
gcloud storage rm --recursive --read-paths-from-stdin

# ---------------------- #
# Cleanup other branches #
# ---------------------- #

- name: Clean up Dialtone ${{ needs.get-branch-name.outputs.current_branch }}
if: ${{ github.ref != 'refs/heads/production' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_BUCKET_DIRECTORY) }}

- name: Clean up Dialtone Vue 2 ${{ needs.get-branch-name.outputs.current_branch }}
if: ${{ github.ref != 'refs/heads/production' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_2_BUCKET_DIRECTORY) }}

- name: Clean up Dialtone Vue 3 ${{ needs.get-branch-name.outputs.current_branch }}
if: ${{ github.ref != 'refs/heads/production' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_3_BUCKET_DIRECTORY) }}

# ---------- #
# GCP Upload #
# ---------- #

- name: Upload Dialtone to GCP
uses: google-github-actions/upload-cloud-storage@v1
with:
path: apps/dialtone-documentation/docs/.vuepress/dist
destination: ${{ env.DIALTONE_BUCKET_DIRECTORY }}
parent: false

- name: Upload Dialtone-vue 2 to GCP
uses: google-github-actions/upload-cloud-storage@v1
with:
path: packages/dialtone-vue2/storybook-static
destination: ${{ env.DIALTONE_VUE_2_BUCKET_DIRECTORY }}
parent: false

- name: Upload Dialtone-vue 3 to GCP
uses: google-github-actions/upload-cloud-storage@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ on:
- staging
paths:
- 'packages/dialtone-vue3'
- 'packages/dialtone-vue2'

jobs:
dialtone-vue-3:
test:
runs-on: ubuntu-latest
steps:
- name: Check out branch
Expand Down Expand Up @@ -43,4 +44,4 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Run unit tests
run: pnpm nx run dialtone-vue3:test
run: pnpm nx run-many --target=test --projects=dialtone-vue2,dialtone-vue3
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@
"build": "pnpm nx run-many --target=build",
"start:dialtone": "pnpm nx run-many --target=start --projects=dialtone,dialtone-documentation",
"start:dialtone-vue3": "pnpm nx run-many --target=start --projects=dialtone,dialtone-vue3",
"start:dialtone-vue2": "pnpm nx run-many --target=start --projects=dialtone,dialtone-vue2",
"prepare": "husky install",
"release": "./scripts/release.sh"
},
"author": "",
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"husky": "^8.0.3",
"nx": "^17.1.3",
"semantic-release-npm-github-publish": "^1.5.4",
"semantic-release-plus": "^20.0.0"
},
"pnpm": {
"packageExtensions": {
"vue-template-compiler": {
"peerDependencies": {
"vue": "^2.7.15"
}
}
}
},
"resolutions": {
"@dialpad/dialtone>postcss-preset-env": "^7.0.0",
"@dialpad/dialtone>stylelint": "^15.10.1"
Expand Down
18 changes: 18 additions & 0 deletions packages/dialtone-vue2/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const componentsList = require('./common/components_list.cjs');
componentsList.push('btn', 'select', 'validation-message', 'label', 'description');
const componentsNames = componentsList.map(name => name.replace('_', '-').replace('.vue', ''));

module.exports = {
extends: [
'standard',
Expand Down Expand Up @@ -145,6 +149,7 @@ module.exports = {
nonwords: false,
}],
'vue/template-curly-spacing': ['error', 'never'],
'vue/no-restricted-class': ['error', `/^d-(?!(${componentsNames.join('|')})).*/`],
},
overrides: [
{
Expand Down Expand Up @@ -173,6 +178,19 @@ module.exports = {
'vue/no-bare-strings-in-template': [
'off',
],
'vue/no-restricted-class': [
'off',
],
},
},
{
files: [
'common/**',
],
rules: {
'vue/no-restricted-class': [
'off',
],
},
},
],
Expand Down
1 change: 0 additions & 1 deletion packages/dialtone-vue2/.github/CODEOWNERS

This file was deleted.

Loading
Loading