-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1286 from City-of-Helsinki/release-3.8.0
release-3.8.0
- Loading branch information
Showing
103 changed files
with
1,564 additions
and
452 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# this is reference workflow to run e2e tests and get test results | ||
name: e2e-tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- playwright_initial_HDS-2224 | ||
|
||
jobs: | ||
e2e-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read .nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | ||
id: nvmrc | ||
|
||
- name: setup node ${{ steps.nvmrc.outputs.NODE_VERSION }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '${{ steps.nvmrc.outputs.NODE_VERSION }}' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: install dependencies | ||
run: | | ||
yarn config set network-timeout 300000 | ||
yarn | ||
working-directory: ./e2e | ||
|
||
- name: install test tools | ||
run: | | ||
yarn inst | ||
working-directory: ./e2e | ||
|
||
- name: run tests | ||
run: | | ||
yarn start | ||
env: | ||
E2E_TESTS_ENV_URL: "https://hds.hel.fi" | ||
working-directory: ./e2e | ||
|
||
- name: upload test results in case of failure | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: e2e_test_report | ||
path: e2e/report/** | ||
# if: failure() | ||
|
||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
files: | | ||
e2e/report/**/*.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: hds-demo-preview-clean | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
- release-* | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build_and_publish_demo: | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code hds-demo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: City-of-Helsinki/hds-demo | ||
path: hds-demo | ||
ssh-key: ${{ secrets.HDSDEMO_SSH_DEPLOY_KEY }} | ||
|
||
- name: Remove PR directory | ||
id: remove_preview | ||
run: | | ||
if [ -d "./docs/preview_${{ github.event.number }}" ] ; then | ||
rm -fr ./docs/preview_${{ github.event.number }} | ||
echo "preview_exists=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "preview_exists=false" >> $GITHUB_OUTPUT | ||
fi | ||
working-directory: ./hds-demo | ||
|
||
- name: Commit | ||
if: steps.remove_preview.outputs.preview_exists == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
git status | ||
git add . | ||
git commit -m "Updated pr ${{ github.event.number }}" | ||
git push | ||
working-directory: ./hds-demo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: hds-demo-preview | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
- release-* | ||
push: | ||
branches: | ||
- development | ||
- release-* | ||
|
||
|
||
jobs: | ||
build_and_publish_demo: | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PATH_PREFIX: "/hds-demo/preview_${{ github.event.number != '' && github.event.number || github.ref_name }}" | ||
DEMO_NAME: preview_${{ github.event.number != '' && github.event.number || github.ref_name }} | ||
|
||
steps: | ||
- name: Checkout code hds | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read .nvmrc | ||
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | ||
id: nvmrc | ||
|
||
- name: setup node ${{ steps.nvmrc.outputs.NODE_VERSION }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '${{ steps.nvmrc.outputs.NODE_VERSION }}' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
# Github cache | ||
- name: get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: restore yarn cache | ||
uses: actions/cache@v3 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
yarn-cache-folder- | ||
- name: restore lerna | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: yarn-node_modules-folder-${{ hashFiles('**/yarn.lock') }} | ||
|
||
# Build | ||
- name: install dependencies | ||
run: | | ||
yarn config set network-timeout 300000 | ||
yarn | ||
# Build site | ||
- name: build design tokens package | ||
run: yarn build | ||
working-directory: ./packages/design-tokens | ||
|
||
- name: build core package | ||
run: yarn build | ||
working-directory: ./packages/core | ||
|
||
- name: build react package | ||
run: yarn build | ||
working-directory: ./packages/react | ||
|
||
- name: build hds-js package | ||
run: yarn build:hds-js | ||
working-directory: ./packages/react | ||
|
||
- name: build site package | ||
run: yarn build --prefix-paths | ||
working-directory: ./site | ||
|
||
# Build core storybook | ||
- name: build core storybook | ||
run: yarn build-storybook | ||
working-directory: ./packages/core | ||
|
||
- name: move core storybook under site | ||
run: mkdir ./site/public/storybook && mv ./packages/core/storybook-static $_/core | ||
|
||
# Build react storybook | ||
- name: build react storybook | ||
run: yarn build-storybook | ||
working-directory: ./packages/react | ||
|
||
- name: move react storybook under site | ||
run: mv ./packages/react/storybook-static ./site/public/storybook/react | ||
|
||
# Publish to hds-demo | ||
- name: Checkout code hds-demo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: City-of-Helsinki/hds-demo | ||
path: hds-demo | ||
ssh-key: ${{ secrets.HDSDEMO_SSH_DEPLOY_KEY }} | ||
|
||
- name: Clean old directory | ||
run: | | ||
rm -fr ./hds-demo/docs/$DEMO_NAME | ||
mkdir -p ./hds-demo/docs/$DEMO_NAME | ||
- name: Copy build results | ||
run: cp -r ./site/public/* ./hds-demo/docs/$DEMO_NAME | ||
|
||
- name: Commit | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
git status | ||
git add . | ||
git commit -m "Updated preview to $DEMO_NAME" | ||
git status | ||
git push | ||
working-directory: ./hds-demo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,16 +31,19 @@ jobs: | |
# Don't do anything if we're on release-x.x.x AND the icon-kit has the same version number (already built for the release) | ||
# Skip this step if workflow was triggered by workflow_dispatch | ||
- name: Check if icon library has already been built for this release | ||
id: build_checker | ||
if: github.event_name != 'workflow_dispatch' | ||
run: | | ||
PKG_VER=`node -pe "require('./packages/react/package.json').version"` | ||
ICON_KIT_VER=`sed -n -E 's/.*version[[:space:]]+([0-9]+([.][0-9]+)*).*/\1/p' ./release/icon-kit-template-CHANGELOG.txt` | ||
if [[ ${PKG_VER} == ${ICON_KIT_VER} ]]; then | ||
echo "Icon library has already been built for this release, skipping" | ||
echo "SKIP_REST_STEPS=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
- name: Run Glypfig | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: | | ||
npx glypfig \ | ||
--apikey $API_KEY \ | ||
|
@@ -61,46 +64,58 @@ jobs: | |
NODE_ID: '172:2478' | ||
|
||
- name: Append React interface into index file | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: | | ||
echo -e "export { IconProps } from './Icon.interface';\n" | \ | ||
cat - ./icon-library/react/tsx/index.ts > temp && mv temp ./icon-library/react/tsx/index.ts | ||
- name: Bump version in Changelog | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: | | ||
PKG_VER=`node -pe "require('./packages/react/package.json').version"` | ||
sed -i -E "s/version [0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}/version ${PKG_VER}/" ./release/icon-kit-template-CHANGELOG.txt | ||
- name: Copy Changelog file to icon library | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: cp ./release/icon-kit-template-CHANGELOG.txt ./icon-library/CHANGELOG.txt | ||
|
||
- name: Create release zip file | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
uses: TheDoctor0/[email protected] | ||
with: | ||
filename: 'release/hds-icon-kit.zip' | ||
path: './icon-library' | ||
|
||
- name: Copy svg files to repo folders | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: cp ./icon-library/svg/* ./packages/core/src/svg | ||
|
||
- name: Copy css files to repo folders | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: cp ./icon-library/css/* ./packages/core/src/icons | ||
|
||
- name: Copy react files to repo folders | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: cp ./icon-library/react/tsx/* ./packages/react/src/icons | ||
|
||
- name: Install React package NPM dependencies | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: (cd ./packages/react && yarn) | ||
|
||
- name: Lint React files | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: npx prettier --write './packages/react/src/icons/*.{ts,tsx}' | ||
|
||
- name: Code analysis for React files | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: npx eslint --debug -c './packages/react/.eslintrc.json' --ignore-path './packages/react/.eslintignore' --fix './packages/react/src/icons/*.{ts,tsx}' | ||
|
||
- name: Remove icon library build directory | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: rm -rf ./icon-library | ||
|
||
- name: Commit changed files | ||
if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
|
Oops, something went wrong.