test: [M3-8864] - Cypress tests to validate errors in Linode Create B… #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- master | |
- staging | |
- develop | |
pull_request: | |
jobs: | |
lint: | |
strategy: | |
matrix: | |
package: ["linode-manager", "@linode/api-v4", "@linode/validation", "@linode/ui"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace ${{ matrix.package }} run lint | |
build-validation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace @linode/validation run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
publish-validation: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: build-validation | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: JS-DevTools/npm-publish@v1 | |
id: npm-publish | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./packages/validation/package.json | |
- name: slack-notify | |
uses: rtCamp/action-slack-notify@master | |
if: steps.npm-publish.outputs.type != 'none' | |
env: | |
SLACK_CHANNEL: api-js-client | |
SLACK_TITLE: "Linode Validation v${{ steps.npm-publish.outputs.version}}" | |
SLACK_MESSAGE: ":rocket: Linode Validation Library has been published to NPM: ${{ steps.npm-publish.outputs.old-version }} => ${{ steps.npm-publish.outputs.version }}. View the changelog at https://github.com/linode/manager/blob/master/packages/validation/CHANGELOG.md" | |
SLACK_USERNAME: npm-bot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON_EMOJI: ":package:" | |
MSG_MINIMAL: true | |
test-sdk: | |
runs-on: ubuntu-latest | |
needs: build-validation | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- run: yarn workspace @linode/api-v4 run test | |
build-sdk: | |
runs-on: ubuntu-latest | |
needs: build-validation | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace @linode/api-v4 run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
validate-sdk: | |
runs-on: ubuntu-latest | |
needs: build-sdk | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
# Download the validation and api-v4 artifacts (built packages) | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
# Create an api-v4 tarball | |
- run: cd packages/api-v4 && npm pack --pack-destination ../../ | |
# Create an validation tarball | |
- run: cd packages/validation && npm pack --pack-destination ../../ | |
# Test @linode/api-v4 as an ES Module | |
- run: mkdir test-sdk-esm && cd test-sdk-esm && npm init es6 -y && npm install ../$(ls ../ | grep "linode-api-v4-.*\.tgz") ../$(ls ../ | grep "linode-validation-.*\.tgz") | |
- run: cp scripts/validatePackages/sdk-esm.js test-sdk-esm/ | |
- run: cd test-sdk-esm && node ./sdk-esm.js | |
# Verify @linode/api-v4 as CommonJS | |
- run: mkdir test-sdk-cjs && cd test-sdk-cjs && npm init -y && npm install ../$(ls ../ | grep "linode-api-v4-.*\.tgz") ../$(ls ../ | grep "linode-validation-.*\.tgz") | |
- run: cp scripts/validatePackages/sdk-commonjs.cjs test-sdk-cjs/ | |
- run: cd test-sdk-cjs && node ./sdk-commonjs.cjs | |
test-manager: | |
runs-on: ubuntu-latest | |
needs: build-sdk | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace linode-manager run test | |
test-search: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace @linode/search run test | |
test-ui: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace @linode/ui run test | |
typecheck-ui: | |
runs-on: ubuntu-latest | |
needs: build-sdk | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace @linode/ui run typecheck | |
typecheck-manager: | |
runs-on: ubuntu-latest | |
needs: build-sdk | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace linode-manager run typecheck | |
build-manager: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: build-sdk | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace linode-manager run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-manager-build | |
path: packages/manager/build | |
publish-sdk: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- test-sdk | |
- validate-sdk | |
# If the validation publish failed we could have mismatched versions and a broken JS client | |
- publish-validation | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
- uses: JS-DevTools/npm-publish@v1 | |
id: npm-publish | |
with: | |
token: ${{ secrets.NPM_AUTH_TOKEN }} | |
package: ./packages/api-v4/package.json | |
- name: slack-notify | |
uses: rtCamp/action-slack-notify@master | |
if: steps.npm-publish.outputs.type != 'none' | |
env: | |
SLACK_CHANNEL: api-js-client | |
SLACK_TITLE: "Linode JS Client v${{ steps.npm-publish.outputs.version}}" | |
SLACK_MESSAGE: ":rocket: Linode JS Client has been published to NPM: ${{ steps.npm-publish.outputs.old-version }} => ${{ steps.npm-publish.outputs.version }}. View the changelog at https://github.com/linode/manager/blob/master/packages/api-v4/CHANGELOG.md" | |
SLACK_USERNAME: npm-bot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON_EMOJI: ":package:" | |
MSG_MINIMAL: true | |
build-storybook: | |
runs-on: ubuntu-latest | |
needs: build-sdk | |
env: | |
NODE_OPTIONS: --max-old-space-size=4096 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.17" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-validation-lib | |
path: packages/validation/lib | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packages-api-v4-lib | |
path: packages/api-v4/lib | |
- run: yarn --frozen-lockfile | |
- run: yarn workspace linode-manager run build-storybook | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: storybook-build | |
path: packages/manager/storybook-static | |
publish-storybook: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: build-storybook | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: storybook-build | |
path: storybook/build | |
- uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_ENDPOINT: https://us-east-1.linodeobjects.com | |
AWS_S3_BUCKET: ${{ secrets.STORYBOOK_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-east-1 | |
SOURCE_DIR: storybook/build |