Skip to content

Commit

Permalink
Merge branch 'staging' into chip-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo-Signorelli authored Apr 4, 2024
2 parents b05ff43 + 58dadce commit 0a9f742
Show file tree
Hide file tree
Showing 97 changed files with 8,297 additions and 1,305 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye

# Install deps
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends chromium

# Define env vars
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

# [Optional] Uncomment if you want to install an additional version of node using nvm
ARG EXTRA_NODE_VERSION="lts/hydrogen"
RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
81 changes: 81 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "@sme.up/ketchup-root",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "18-bullseye",
"EXTRA_NODE_VERSION": "18.16"
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// "ghcr.io/devcontainers/features/node:1": {
// "nodeGypDependencies": true,
// "version": "lts",
// "nvmVersion": "latest"
// },
"ghcr.io/devcontainers-contrib/features/lerna-npm:1": {
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/nx-npm:1": {
"version": "latest"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sh .devcontainer/scripts/postCreateCommand.sh",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner",
"octref.vetur"
],
"settings": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["vue", "html", "javascript", "typescript"],
"eslint.run": "onSave",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
}
},
"mounts": [
"source=ketchup-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", // deps volume
"source=ketchup-vscode-extensions,target=/root/.vscode-server/extensions,type=volume" // vscode extensions volume
]

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
7 changes: 7 additions & 0 deletions .devcontainer/scripts/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Set permissions"
sudo chown -R node:node node_modules

echo "Installing Deps"
yarn install
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: 'devcontainers'
directory: '/'
schedule:
interval: weekly
ignore:
- dependency-name: '*'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
101 changes: 101 additions & 0 deletions .github/workflows/continuum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: continuum

on:
push:
branches:
- develop

env:
VERSION: 10.0.0-SNAPSHOT
AWS_REGION: eu-south-1

jobs:
ketchup-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
cache: "yarn"

- name: Install dependencies
run: yarn install --immutable

- name: Run Ketchup build
run: npm run k:build

- name: Run Ketchup Showcase build
run: npm run ksc:build

- name: Zip artifacts
run: |
cd packages/ketchup/dist
zip -qr /tmp/ketchup.zip *
zip -qr /tmp/ketchup-components.zip ketchup/*
- name: Setup AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Upload artifacts to AWS S3
run: |
aws s3 cp /tmp/ketchup.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ env.VERSION }}/zip/ketchup.zip
aws s3 cp /tmp/ketchup-components.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ env.VERSION }}/zip/ketchup-components.zip
# Prepare GitHub Pages Showcase deployment
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./packages/ketchup-showcase/dist"

# Showcase Deployment Job
showcase-release:
needs: ketchup-release
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

trigger-webup-continuum:
needs: ketchup-release
runs-on: ubuntu-latest
steps:
- run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.ROBBY_SMEUP_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/smeup/webup-project/actions/workflows/continuum.yaml/dispatches \
-d '{"ref": "develop"}'
trigger-webupjs-develop:
needs: ketchup-release
runs-on: ubuntu-latest
steps:
- run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.ROBBY_SMEUP_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/smeup/webup.js/actions/workflows/develop-release.yaml/dispatches \
-d '{"ref": "develop"}'
47 changes: 47 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release

on:
push:
tags: "*"

env:
AWS_REGION: eu-south-1

jobs:
ketchup-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
cache: "yarn"

- name: Install dependencies
run: yarn install --immutable

- name: Run Ketchup build
run: npm run k:build

- name: Run Ketchup Showcase build
run: npm run ksc:build

- name: Zip artifacts
run: |
cd packages/ketchup/dist
zip -qr /tmp/ketchup.zip *
zip -qr /tmp/ketchup-components.zip ketchup/*
- name: Setup AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Upload artifacts to AWS S3
run: |
aws s3 cp /tmp/ketchup.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ github.ref_name }}/zip/ketchup.zip
aws s3 cp /tmp/ketchup-components.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ github.ref_name }}/zip/ketchup-components.zip
52 changes: 52 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: staging

on:
push:
branches:
- staging

env:
VERSION: TEST-SNAPSHOT
AWS_REGION: eu-south-1

jobs:
showcase-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
cache: "yarn"

- name: Install dependencies
run: yarn install --immutable

- name: Run Ketchup build
run: npm run k:build

- name: Run Ketchup Showcase build
run: npm run ksc:build

- name: Zip artifacts
run: |
cd packages/ketchup/dist
zip -qr /tmp/ketchup.zip *
zip -qr /tmp/ketchup-components.zip ketchup/*
- name: Setup AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Upload artifacts to AWS S3
run: |
aws s3 cp /tmp/ketchup.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ env.VERSION }}/zip/ketchup.zip
aws s3 cp /tmp/ketchup-components.zip s3://smeup-ketchup/npm-pub/ketchup-stencil/${{ env.VERSION }}/zip/ketchup-components.zip
- name: Upload showcase to AWS S3
run: aws s3 sync packages/ketchup-showcase/dist/ s3://smeup-ketchup/staging/ --delete
35 changes: 0 additions & 35 deletions .github/workflows/test.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Ketchup Unit Test

on:
pull_request:
branches:
- develop
- master

jobs:
unit-test:
runs-on: ubuntu-latest
concurrency:
group: generate-docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
cache: "yarn"

- name: Install dependencies
run: yarn install --immutable

- name: Run build
run: npm run k:build

- name: Execute tests
run: npm run k:test:unit
Loading

0 comments on commit 0a9f742

Please sign in to comment.