Skip to content

Commit c42f63a

Browse files
committed
Add CICD, remove binary folders which are auto cleaned and add them to gitignore folder, get eslint running with script, add mvn pom.xml wrapper for Java base Full Stack Devleopers
1 parent cdb7160 commit c42f63a

File tree

210 files changed

+1712
-63154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+1712
-63154
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
"browser": true,
44
"es2021": true,
55
},
6-
"extends": ["eslint:recommended", "plugin:storybook/recommended"],
6+
"extends": ["eslint:recommended", "plugin:json/recommended", "plugin:storybook/recommended"],
77
"overrides": [
88
{
99
"env": {
@@ -15,7 +15,7 @@ module.exports = {
1515
"parserOptions": {
1616
"sourceType": "script",
1717
},
18-
},
18+
}
1919
],
2020
"parserOptions": {
2121
"ecmaVersion": "latest",

.github/workflows/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
TARGET_REPO secret must be set
3+
4+
e.g.
5+
6+
qld-gov-au/formio-qld
7+
8+
GH_TOKEN secret must be set
9+
10+
At this time this for repo qld-gov-au/formio it is set to a GHA token for @duttonw
11+
12+
structure of the GH_TOKEN is
13+
14+
${username}:${token}
15+
16+
e.g. username:mypersonalaccesstoken
17+
18+
if this fails, generate a new token via
19+
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
20+
and update the secret

.github/workflows/compile.js.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build and Test
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
concurrency:
11+
group: compile-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
12+
cancel-in-progress: true
13+
14+
jobs:
15+
validate:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node: [ '20']
21+
name: Lint test on Node ${{ matrix.node }}
22+
steps:
23+
- run: echo ${{github.ref}}
24+
25+
- uses: actions/checkout@v4
26+
27+
- name: Use Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node }}
31+
cache: 'npm'
32+
#always-auth: 'true'
33+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
34+
35+
- name: Cache node modules
36+
id: cache-npm
37+
uses: actions/cache@v3
38+
env:
39+
cache-name: cache-node-modules
40+
with:
41+
# npm cache files are stored in `~/.npm` on Linux/macOS
42+
path: ~/.npm
43+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-build-${{ env.cache-name }}-
46+
${{ runner.os }}-build-
47+
${{ runner.os }}-
48+
49+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
50+
name: List the state of node modules
51+
continue-on-error: true
52+
run: npm list
53+
54+
- name: npmrc #run on lint step (Which is cached)
55+
run: |
56+
npm -v
57+
node -v
58+
# cat /home/runner/work/_temp/.npmrc #only nice to test when registry is altered
59+
#env:
60+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
61+
62+
- name: Install
63+
run: | # Install packages
64+
npm install --prefer-offline --no-audit --ignore-scripts --force
65+
#env:
66+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
67+
68+
# `npm rebuild` will run all those post-install scripts for us.
69+
- name: rebuild and prepare
70+
run: npm rebuild && npm run prepare --if-present
71+
72+
- name: Lint
73+
run: |
74+
npm run lint
75+
- name: Test
76+
run: |
77+
npm run test
78+
79+
build:
80+
needs: validate
81+
runs-on: ubuntu-latest
82+
strategy:
83+
matrix:
84+
node: [ '20' ]
85+
name: Build and Deploy on Node ${{ matrix.node }}
86+
steps:
87+
- uses: actions/checkout@v4.1.2
88+
89+
- name: Cache node modules
90+
id: cache-npm
91+
uses: actions/cache@v3
92+
env:
93+
cache-name: cache-node-modules
94+
with:
95+
# npm cache files are stored in `~/.npm` on Linux/macOS
96+
path: ~/.npm
97+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
98+
restore-keys: |
99+
${{ runner.os }}-build-${{ env.cache-name }}-
100+
${{ runner.os }}-build-
101+
${{ runner.os }}-
102+
103+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
104+
name: List the state of node modules
105+
continue-on-error: true
106+
run: npm list
107+
108+
- name: Use Node.js
109+
uses: actions/setup-node@v4.0.2
110+
with:
111+
node-version: ${{ matrix.node }}
112+
cache: 'npm'
113+
#always-auth: 'true'
114+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
115+
registry-url: 'https://registry.npmjs.org'
116+
- name: Install #run on lint step (Which is cached)
117+
run: | # Install packages
118+
npm install --prefer-offline --no-audit --ignore-scripts
119+
#env:
120+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
121+
122+
# `npm rebuild` will run all those post-install scripts for us.
123+
- name: rebuild and prepare
124+
run: npm rebuild && npm run prepare --if-present
125+
126+
- name: Build 🔧
127+
run: | # build the files
128+
npm run build
129+
# - name: Build storybook 🔧
130+
# run: | # build the Storybook files
131+
# npm run build-storybook
132+
133+
- name: setup Package
134+
run: |
135+
ls -ltr
136+
mkdir -p ./target/docs
137+
cp -r ./docs ./target/docs
138+
cp -r ./dist ./target/dist
139+
140+
- uses: actions/upload-artifact@v4.3.1
141+
with:
142+
name: Package
143+
path: ./target
144+
145+
146+
- name: Extract branch name
147+
shell: bash
148+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
149+
id: extract_branch
150+
151+
- name: display branch name
152+
shell: bash
153+
run: echo "${{ steps.extract_branch.outputs.branch }}"
154+
155+
156+
- name: setup Publish
157+
run: |
158+
set -x
159+
cp -r ./binary-repo/* ./dist
160+
161+
- name: Publish qgds-qol-dist
162+
uses: qld-gov-au/gha-publish-to-git@master
163+
with:
164+
repository: ${{ secrets.TARGET_REPO }}
165+
git_ref: '${{ github.ref }}'
166+
branch: '${{ steps.extract_branch.outputs.branch }}'
167+
github_token: '${{ secrets.GH_TOKEN }}'
168+
github_pat: '${{ secrets.GH_PAT }}'
169+
source_folder: dist
170+
tag_branch: main
171+
if: success()
172+
173+
- name: Publish to qgds-qol-cdn
174+
uses: qld-gov-au/gha-cdn-version-tree-by-tag-builder@main
175+
with:
176+
repository: 'qld-gov-au/formio-qld-cdn'
177+
git_ref: '${{ github.ref }}'
178+
branch: 'release'
179+
github_token: '${{ secrets.GH_TOKEN }}'
180+
github_pat: '${{ secrets.GH_PAT }}'
181+
source_folder: dist
182+
if: success()
183+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Storybook deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: [Build and Test] # Reuse the name of your tests workflow
6+
branches: [main, develop]
7+
types: [completed ]
8+
9+
concurrency:
10+
group: deploy-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy:
15+
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
node: [ '20' ]
20+
name: Deploy with Node ${{ matrix.node }}
21+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Cache node modules
26+
id: cache-npm
27+
uses: actions/cache@v3
28+
env:
29+
cache-name: cache-node-modules
30+
with:
31+
# npm cache files are stored in `~/.npm` on Linux/macOS
32+
path: ~/.npm
33+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-build-${{ env.cache-name }}-
36+
${{ runner.os }}-build-
37+
${{ runner.os }}-
38+
39+
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
40+
name: List the state of node modules
41+
continue-on-error: true
42+
run: npm list
43+
44+
- name: Use Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: ${{ matrix.node }}
48+
cache: 'npm'
49+
#always-auth: 'true'
50+
#registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/'
51+
registry-url: 'https://registry.npmjs.org'
52+
- name: Install
53+
run: | # Install packages
54+
npm install --prefer-offline --no-audit --ignore-scripts
55+
#env:
56+
# NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }}
57+
58+
# `npm rebuild` will run all those post-install scripts for us. Without our secret key in ENV
59+
- name: rebuild and prepare
60+
run: npm rebuild && npm run prepare --if-present
61+
62+
- name: Build 🔧
63+
run: | # build the files
64+
npm run build
65+
- name: Build Storybook 🔧
66+
run: | # build the Storybook files
67+
npm run build-storybook
68+
- uses: actions/upload-artifact@v4 #provide nice artifact
69+
with:
70+
name: Storybook
71+
path: storybook-static
72+
- name: Deploy 🚀
73+
uses: JamesIves/github-pages-deploy-action@v4
74+
with:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
BRANCH: gh-pages # The branch the action should deploy to.
77+
FOLDER: storybook-static # The folder that the build-storybook script generates files.
78+
CLEAN: true # Automatically remove deleted files from the deploy branch
79+
TARGET_FOLDER: docs # The folder that we serve our Storybook files from

.github/workflows/updateChangeLog.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Update Changelog
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
inputs:
7+
description:
8+
description: 'Manual change log update'
9+
jobs:
10+
updateChangelog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- name: Update Changelog
17+
# https://github.com/git-chglog/git-chglog#getting-started
18+
run: |
19+
mkdir tmp
20+
pushd tmp
21+
curl -o git-chglog.tar.gz -L https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz
22+
#curl -o git-chglog.tar.gz -L https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_darwin_amd64.tar.gz
23+
tar -zxvf git-chglog.tar.gz
24+
cp ./git-chglog ../git-chglog
25+
popd
26+
rm -rf tmp
27+
chmod u+x git-chglog
28+
./git-chglog -o CHANGELOG.md
29+
rm git-chglog
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v4
32+
with:
33+
commit-message: update changelog
34+
title: Update Changelog
35+
body: Update changelog to reflect release changes
36+
branch: update-changelog
37+
base: main

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
node
12
node_modules
2-
.env
3+
.env
4+
.DS_Store
5+
.vscode
6+
storybook-static/
7+
docs/
8+
dist/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org

0 commit comments

Comments
 (0)