Skip to content

Commit

Permalink
AutoDev Merge
Browse files Browse the repository at this point in the history
The following branches have been merged:
- PR 45 dependabot/npm_and_yarn/samples/weather-forecast/semver-6.3.1 (d5c0272)
- PR 72 NFS-2146-weather-icon-is-missing (437fcf4)

The following branches failed to merge:
  • Loading branch information
Staffbot committed Jun 7, 2024
3 parents e1cb852 + d5c0272 + 437fcf4 commit a5c74e2
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autodev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
autodev:
uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@dont-check-private-key
uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v5.3.0
with:
comments: true
secrets:
Expand Down
137 changes: 95 additions & 42 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ env:
DEPLOYMENT_TARGET: weather
DEPLOYMENT_STATIC_FILES: staffbase.user-profile-client.min.js
DEPLOYMENT_SOURCE: samples/weather-forecast/dist


jobs:
build-and-deploy:
prepare-deployment:
name: Prepare Deployment
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# persisting credentials breaks installing dependencies from private repos
persist-credentials: false
# fetch all history for all branches and tags
fetch-depth: 0

- name: Use Node JS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
Expand All @@ -44,74 +49,122 @@ jobs:
mkdir samples/weather-forecast/icons
cp samples/weather-forecast/resources/weather-forecast.svg samples/weather-forecast/dist/icons
- name: Publish to S3 DE Prod
if: startsWith(github.ref, 'refs/tags/')
uses: Staffbase/[email protected]
continuous-delivery-dev-de1:
name: Continuous Delivery (dev de1)
needs: prepare-deployment
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/dev'
steps:
- name: Deploy
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
target: ${{ env.DEPLOYMENT_TARGET }}

# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-main-de1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }}
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }}
frontend_cache_host: frontend-cache-de1.staffbase.dev

# AWS specific settings
aws_bucket: staffbasestatic-prod-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.PROD_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.PROD_DE1_aws_access_key_id_SECRET }}
aws_bucket: staffbasestatic-dev-de1
aws_access_key_id: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_ID }}
aws_access_key_secret: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_SECRET }}

- name: Deploy to S3 US Prod
if: startsWith(github.ref, 'refs/tags/')
uses: Staffbase/[email protected]
continuous-delivery-stage-de1:
name: Continuous Delivery (stage de1)
needs: prepare-deployment
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
target: ${{ env.DEPLOYMENT_TARGET }}

# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-us1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }}
frontend_cache_host: frontend-cache-de1.staffbase.rocks
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }}

# AWS specific settings
aws_bucket: staffbasestatic-prod-us1
aws_region: us-east-1
aws_access_key_id: ${{ secrets.PROD_US1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.PROD_US1_aws_access_key_id_SECRET }}
aws_bucket: staffbasestatic-stage-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_ID }}
aws_access_key_secret: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_SECRET }}

- name: Publish to S3 DE stage
if: github.ref == 'refs/heads/main'
uses: Staffbase/[email protected]
continuous-delivery-prod-de1:
name: Continuous Delivery (prod de1)
needs: prepare-deployment
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
target: ${{ env.DEPLOYMENT_TARGET }}

# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-de1.staffbase.rocks
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }}
frontend_cache_host: frontend-cache-de1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }}

# AWS specific settings
aws_bucket: staffbasestatic-stage-de1
aws_bucket: staffbasestatic-prod-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.STAGE_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.STAGE_DE1_aws_access_key_id_SECRET }}
aws_access_key_id: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_ID }}
aws_access_key_secret: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_SECRET }}

- name: Publish to S3 DE dev
if: github.ref == 'refs/heads/dev'
uses: Staffbase/[email protected]
continuous-delivery-prod-us1:
name: Continuous Delivery (prod us1)
needs: prepare-deployment
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
target: ${{ env.DEPLOYMENT_TARGET }}

# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-us1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }}

# AWS specific settings
aws_bucket: staffbasestatic-prod-us1
aws_region: us-east-1
aws_access_key_id: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_ID }}
aws_access_key_secret: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_SECRET }}

continuous-delivery-prod-au1:
name: Continuous Delivery (prod au1)
needs: prepare-deployment
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
target: ${{ env.DEPLOYMENT_TARGET }}

# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-de1.staffbase.dev
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }}
frontend_cache_host: frontend-cache-au1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_AU1_PASSWORD }}

# AWS specific settings
aws_bucket: staffbasestatic-dev-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.DEV_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.DEV_DE1_aws_access_key_id_SECRET }}
aws_bucket: staffbasestatic-prod-au1
aws_region: ap-southeast-2
aws_access_key_id: ${{ secrets.PROD_AU1_AWS_ACCESS_KEY_ID }}
aws_access_key_secret: ${{ secrets.PROD_AU1_AWS_ACCESS_KEY_SECRET }}
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: CI Tests
env:
NODE_VERSION: 14
NODE_VERSION: 16
on:
push:
paths-ignore:
- '**.md'

jobs:
executing-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand All @@ -17,17 +17,17 @@ jobs:
persist-credentials: false

- name: Use Node.js Version
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com/'
scope: '@staffbase'

- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.STAFFBOT_NPM_READ }}" >> .npmrc

- name: Install Yarn Dependencies
working-directory: samples/weather-forecast
run: yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.STAFFBOT_NPM_READ }}

- name: Run Build
working-directory: samples/weather-forecast
Expand Down
4 changes: 2 additions & 2 deletions samples/weather-forecast/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module.exports = {
setupFilesAfterEnv: ["./test/jest-setup.js"],
resetMocks: true,
moduleNameMapper: {
'icons/(.*)\.svg$': '<rootDir>/__mocks__/lazySvgMock.js',
'\\.svg$': '<rootDir>/__mocks__/fileMock.js',
'icons/(.*)\.(png|svg)$': '<rootDir>/__mocks__/lazySvgMock.js',
'\\.(png|svg)$': '<rootDir>/__mocks__/fileMock.js',
},
testEnvironment: 'jsdom',
};
3 changes: 2 additions & 1 deletion samples/weather-forecast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@testing-library/react": "12.0.0",
"@testing-library/react-hooks": "7.0.2",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/node": "16.7.10",
"@types/node": "20.14.2",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/webpack": "5.28.0",
Expand All @@ -72,6 +72,7 @@
"ts-loader": "^9.2.5",
"ts-node": "10.2.1",
"typescript": "4.4.2",
"url-loader": "^4.1.1",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/weather-forecast/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { WeatherForecastProps, WeatherForecast } from "./weather-forecast";
import { configurationSchema, uiSchema } from "./configuration-schema";
import pkg from "../package.json";
import icon from "../resources/weather-forecast.svg";
import widgetIcon from "../weather-forecast.png";

/**
* This factory creates the class which is registered with the tagname in the `custom element registry`
Expand Down Expand Up @@ -80,7 +80,7 @@ const blockDefinition: BlockDefinition = {
configurationSchema: configurationSchema,
uiSchema: uiSchema,
label: "Weather",
iconUrl: icon,
iconUrl: widgetIcon,
};

/**
Expand Down
4 changes: 4 additions & 0 deletions samples/weather-forecast/src/types/assets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "*.png" {
const value: any;

Check warning on line 2 in samples/weather-forecast/src/types/assets.d.ts

View workflow job for this annotation

GitHub Actions / executing-tests

Unexpected any. Specify a different type
export default value;
}
Binary file added samples/weather-forecast/weather-forecast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions samples/weather-forecast/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ const config: webpack.Configuration = {
test: /\.svg$/i,
use: ["@svgr/webpack"],
},
{
test: /\.(png|jpg|gif)$/i,
use: [
{
loader: "url-loader",
options: {
limit: 8192,
},
},
],
},
],
},
resolve: {
Expand Down
41 changes: 26 additions & 15 deletions samples/weather-forecast/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2485,11 +2485,6 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@staffbase/[email protected]":
version "1.0.0"
resolved "https://npm.pkg.github.com/download/@Staffbase/browserslist-config/1.0.0/57ddcbc99a2509ba6a58e37ec6c2730dccc875de#57ddcbc99a2509ba6a58e37ec6c2730dccc875de"
integrity sha512-IvzkYFUaeH/BIrg097Lw3L/pO2XRIEJEcPmmnhORrZrbnpoWknx836sm6te8fad9qRjQwY+y0UzuWX2VcEtFhg==

"@staffbase/widget-sdk@^3.3.3":
version "3.3.3"
resolved "https://registry.yarnpkg.com/@staffbase/widget-sdk/-/widget-sdk-3.3.3.tgz#79da379765dddedd76d50dbf955f01a9e3a4907f"
Expand Down Expand Up @@ -2879,10 +2874,12 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.10.tgz#e57e2a54fc6da58da94b3571b1cb456d39f88597"
integrity sha512-TmVHsm43br64js9BqHWqiDZA+xMtbUpI1MBIA0EyiBmoV9pcEYFOSdj5fr6enZNfh4fChh+AGOLIzGwJnkshyQ==

"@types/[email protected]":
version "16.7.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.10.tgz#7aa732cc47341c12a16b7d562f519c2383b6d4fc"
integrity sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==
"@types/[email protected]":
version "20.14.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18"
integrity sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==
dependencies:
undici-types "~5.26.4"

"@types/parse-json@^4.0.0":
version "4.0.0"
Expand Down Expand Up @@ -7629,14 +7626,14 @@ [email protected]:
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==

semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
version "6.3.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==

semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
dependencies:
lru-cache "^6.0.0"

Expand Down Expand Up @@ -8221,6 +8218,11 @@ unbox-primitive@^1.0.1:
has-symbols "^1.0.2"
which-boxed-primitive "^1.0.2"

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"
Expand Down Expand Up @@ -8305,6 +8307,15 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

url-loader@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.1.tgz#28505e905cae158cf07c92ca622d7f237e70a4e2"
integrity sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==
dependencies:
loader-utils "^2.0.0"
mime-types "^2.1.27"
schema-utils "^3.0.0"

url@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1"
Expand Down

0 comments on commit a5c74e2

Please sign in to comment.