Skip to content

Commit

Permalink
ci(pie-storybook): DSW-2468 Add testing deployment for storybook REVE…
Browse files Browse the repository at this point in the history
…RT (#2055)

Revert "ci(pie-storybook): DSW-2468 Add testing deployment for storybook (#2046)"

This reverts commit 581e048.
  • Loading branch information
JoshuaNg2332 authored Nov 12, 2024
1 parent 581e048 commit 68cb427
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 160 deletions.
9 changes: 5 additions & 4 deletions .github/actions/amplify-teardown/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ runs:
env:
APP_ID: ${{ inputs.amplify-app-id }}
BRANCH_NAME: ${{ inputs.branch-name }}
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
AWS_REGION: ${{ inputs.aws-region }}
run: |
aws amplify delete-branch \
--app-id "$APP_ID" \
--branch-name "$BRANCH_NAME"
--branch-name "$BRANCH_NAME"
env:
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
AWS_REGION: ${{ inputs.aws-region }}
21 changes: 6 additions & 15 deletions .github/workflows/amplify-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ on:
required: false
type: string
default: 'build'
destination-dir:
required: false
type: string
default: '/'
sub-domain-suffix:
required: true
type: string

env:
AMPLIFY_ID: ${{ inputs.amplify-app-id }}
Expand Down Expand Up @@ -70,13 +63,13 @@ jobs:
with:
script-name: "${{inputs.build-script }} --filter=${{ inputs.package-name }}"
# Create Github Deployment
- name: Create GitHub deployment
- name: Create Docs GitHub deployment
if: ${{ github.event_name == 'pull_request' }}
uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7
id: deploy
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: "${{ inputs.sub-domain-suffix }}-pr-${{ github.event.number }}"
environment: "${{ inputs.package-name}}-pr-${{ github.event.number }}"
# Zip dist folder
- name: Zip build output
shell: bash
Expand All @@ -93,11 +86,10 @@ jobs:
aws-region: ${{ env.AWS_REGION }}
aws-bucket: ${{ env.BUCKET_NAME }}
bucket-root: "/"
destination-dir: "${{ inputs.destination-dir }}"
destination-dir: "/"
file-path: "${{inputs.package-dist-directory}}/${{ env.ZIP_NAME }}"
content-type: "application/zip"
public: true
output-file-url: 'true'
# Create branch on Amplify
- name: Create Amplify branch
shell: bash
Expand All @@ -114,14 +106,13 @@ jobs:
aws amplify start-deployment \
--app-id ${{ env.AMPLIFY_ID }} \
--branch-name ${{ env.BRANCH_NAME }} \
--source-url ${{ steps.upload-s3.outputs.file-url }}
--source-url s3://${{ env.BUCKET_NAME }}/${{ env.ZIP_NAME }}
# Set env vars for domain name association
- name: Set environment variables for domain name association
if: github.event_name == 'pull_request'
env:
SUB_DOMAIN_SUFFIX: ${{ inputs.sub-domain-suffix }}
run: |
echo "SUB_DOMAIN=pr${{ github.event.number }}-$SUB_DOMAIN_SUFFIX" >> $GITHUB_ENV
PACKAGE_NAME_SUFFIX=$(echo "${{ inputs.package-name }}" | sed -e 's/^pie-//')
echo "SUB_DOMAIN=pr${{ github.event.number }}-$PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV
- name: Get existing domain associations
if: github.event_name == 'pull_request'
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,25 +193,6 @@ jobs:
package-dist-directory: ./apps/pie-storybook/dist
bucket-name-preview: 'pie-storybook-preview'
bucket-name-main: 'pie-storybook'
sub-domain-suffix: 'storybook'
secrets: inherit

# Workflow task that deploys an instance of storybook used for test suites to run against
deploy-storybook-testing:
needs: unit-tests
if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main'
uses: ./.github/workflows/amplify-deploy.yml
with:
os: ubuntu-latest
node-version: 20
amplify-app-id: d3eyargno6okyn
package-name: 'pie-storybook'
package-dist-directory: ./apps/pie-storybook/dist
bucket-name-preview: 'pie-storybook-preview'
bucket-name-main: 'pie-storybook'
build-script: 'build:testing'
destination-dir: 'testing'
sub-domain-suffix: 'storybook-testing'
secrets: inherit

# TODO: DSW-1151 - Move this into a reusable action so it's not duplicated
Expand Down Expand Up @@ -282,7 +263,6 @@ jobs:
package-dist-directory: ./apps/pie-docs/dist
bucket-name-preview: 'pie-docs-preview'
bucket-name-main: 'pie-docs'
sub-domain-suffix: 'docs'
secrets: inherit

browser-tests-docs:
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
outputs:
hasDocsEnv: ${{ steps.list-environments.outputs.hasDocsEnv }}
hasStorybookEnv: ${{ steps.list-environments.outputs.hasStorybookEnv }}
hasStorybookTestingEnv: ${{ steps.list-environments.outputs.hasStorybookTestingEnv }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -37,13 +36,11 @@ jobs:
const envList = environments.data.environments.map(env => env.name);
// Check for existence of specific environments
const hasDocsEnv = envList.includes(`docs-pr-${pull_number}`);
const hasStorybookEnv = envList.includes(`storybook-pr-${pull_number}`);
cosnt hasStorybookTestingEnv = envList.includes(`storybook-testing-pr-${pull_number}`);
const hasDocsEnv = envList.includes(`pie-docs-pr-${pull_number}`);
const hasStorybookEnv = envList.includes(`pie-storybook-pr-${pull_number}`);
core.setOutput('hasDocsEnv', hasDocsEnv);
core.setOutput('hasStorybookEnv', hasStorybookEnv);
core.setOutput('hasStorybookTestingEnv', hasStorybookTestingEnv);
- name: Delete associated docs environments
if: steps.list-environments.outputs.hasDocsEnv == 'true'
Expand All @@ -55,7 +52,7 @@ jobs:
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: docs-pr-${{ github.event.number }}
environment-name: pie-docs-pr-${{ github.event.number }}
branch-name: 'pr${{ github.event.number }}'

- name: Delete associated storybook environment
Expand All @@ -68,18 +65,5 @@ jobs:
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: storybook-pr-${{ github.event.number }}
branch-name: 'pr${{ github.event.number }}'

- name: Delete associated storybook testing environments
if: steps.list-environments.outputs.hasStorybookTestingEnv == 'true'
uses: ./.github/actions/amplify-teardown
with:
gh-app-id: ${{ secrets.GH_APP_ID }}
gh-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
amplify-app-id: d3eyargno6okyn
aws-region: 'eu-west-1'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
environment-name: storybook-testing-pr-${{ github.event.number }}
environment-name: pie-storybook-pr-${{ github.event.number }}
branch-name: 'pr${{ github.event.number }}'
17 changes: 5 additions & 12 deletions apps/pie-storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import type { StorybookConfig } from '@storybook/web-components-vite';

const isBrowserTesting = process.env.BROWSER_TESTING === 'true';

const config: StorybookConfig = {
stories: isBrowserTesting
? [
"../stories/**/*.test.mdx",
"../stories/**/*.test.stories.@(js|ts|tsx)"
]
: [
"../stories/**/*.mdx",
"../stories/**/!(*.test).stories.@(js|ts|tsx)"
],
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|ts|tsx)"
],
addons: [
"@storybook/addon-essentials",
"@storybook/addon-a11y",
Expand All @@ -27,6 +20,6 @@ const config: StorybookConfig = {
docs: {
autodocs: false
}
};
}

export default config;
2 changes: 0 additions & 2 deletions apps/pie-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"description": "Storybook for PIE Design System components",
"scripts": {
"dev": "storybook dev -p 6006",
"dev:testing": "BROWSER_TESTING=true storybook dev -p 6006",
"build": "storybook build --output-dir dist && cp -R ./static ./dist",
"build:testing": "BROWSER_TESTING=true storybook build --output-dir dist && cp -R ./static ./dist",
"lint:scripts": "run -T eslint .",
"lint:scripts:fix": "run -T eslint . --fix",
"copy:component-statuses": "cp -v ../../component-statuses.json ."
Expand Down
68 changes: 0 additions & 68 deletions apps/pie-storybook/stories/pie-divider.test.stories.ts

This file was deleted.

18 changes: 1 addition & 17 deletions apps/pie-storybook/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,12 @@
"copy:component-statuses"
]
},
"dev:testing": {
"cache": false,
"dependsOn": [
"^build",
"copy:component-statuses"
]
},
"build": {
"cache": true,
"dependsOn": [
"^build",
"copy:component-statuses"
],
"outputs": ["dist/**"]
},
"build:testing": {
"cache": true,
"dependsOn": [
"^build",
"copy:component-statuses"
],
"outputs": ["dist/**"]
]
},
"copy:component-statuses": {
"dependsOn": [
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"analyse-component-bundles": "bundlewatch --config bundlewatch.config.json",
"watch": "turbo run watch --filter=!pie-monorepo",
"build": "cross-env-shell turbo run build --filter=!'./apps/examples/*' --filter=!pie-monorepo --token=${TURBO_TOKEN}",
"build:testing": "cross-env-shell turbo run build:testing --filter=!'./apps/examples/*' --filter=!pie-monorepo --token=${TURBO_TOKEN}",
"build:dev": "cross-env-shell turbo run build:dev --filter=!'./apps/examples/*' --filter=!pie-monorepo --token=${TURBO_TOKEN}",
"build:examples": "cross-env-shell turbo run build:examples --filter=!pie-monorepo --token=${TURBO_TOKEN}",
"build:react-wrapper": "cross-env-shell turbo run build:react-wrapper --filter=!pie-monorepo --token=${TURBO_TOKEN}",
Expand All @@ -36,7 +35,6 @@
"clean": "turbo run clean --filter=!pie-monorepo",
"cz": "./packages/tools/pie-git-hooks-scripts/check-branch-name.js $(git symbolic-ref --short HEAD) && ./node_modules/cz-customizable/standalone.js",
"dev": "turbo run dev --filter=!pie-monorepo",
"dev:testing": "turbo run dev:testing --filter=!pie-monorepo",
"copy:component-statuses": "cross-env-shell turbo run copy:component-statuses --filter=!pie-monorepo",
"generate:component-statuses": "npx generate-component-statuses",
"generate:examples": "cross-env-shell turbo run generate:examples --filter=!pie-monorepo --token=${TURBO_TOKEN}",
Expand Down

0 comments on commit 68cb427

Please sign in to comment.