Skip to content

Commit

Permalink
Merge pull request #10 from DHBW-FN-TIT20/KWYG-21-CI/CD-einrichten
Browse files Browse the repository at this point in the history
KWYG 21 ci/cd einrichten
  • Loading branch information
schuler-henry authored Dec 10, 2022
2 parents 49eefd9 + 35d2f5a commit 61d3fcb
Show file tree
Hide file tree
Showing 19 changed files with 1,911 additions and 168 deletions.
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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": "Node.js",
"image": "mcr.microsoft.com/devcontainers/javascript-node:16-bullseye",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3000
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install -g [email protected] && npm install",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root",
// Add extensions
"extensions": [
"mhutchie.git-graph",
"donjayamanne.githistory",
"Gruntfuggly.todo-tree",
"GitHub.copilot",
"GitHub.vscode-pull-request-github",
"esbenp.prettier-vscode"
],
"settings": {
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.indentSize": "tabSize",
"editor.tabSize": 2
}
}
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"max-len": [
"error",
{
"code": 120
}
],
"react/prop-types": "off"
},
"ignorePatterns": [
"src/**/*.test.js",
"src/fonts/*"
]
}
93 changes: 93 additions & 0 deletions .github/workflows/new_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Deploy App in GitHub Pages and create realse


name: New Release

on:
push:
branches:
- "main"
tags:
- v*.*.*

jobs:
# Validate the code
call-workflow-2-in-local-repo:
uses: ./.github/workflows/validate_pr.yml

# Build the App
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'

- name: Install packages
run: npm ci

- name: Run Tests
run: npm test --if-present

- name: Build app
run: npm run build

- name: Archive Release
uses: thedoctor0/zip-release@main
with:
type: 'zip'
directory: 'www'
filename: ${{ env.GIT_TAG_NAME }}.zip

- name: Upload artifact
uses: actions/upload-artifact@main
with:
name: github-pages
path: ${{ env.GIT_TAG_NAME }}.zip
retention-days: ${{ inputs.retention-days }}

# Create Release
release:
runs-on: ubuntu-latest
needs: [build]

steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: github-pages

- name: Create release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
files: |
${{ env.GIT_TAG_NAME }}.zip
# Deploy on GitHub Pages
GitHubPages:

runs-on: ubuntu-latest
needs: [build]

steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: github-pages

- name: Unzip Data
uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.GIT_TAG_NAME }}.zip -d www

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: www
31 changes: 31 additions & 0 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Validate the PR to the Sprint branches

name: Check PR for valid code

on:
pull_request:
branches:
- main
- '*Sprint*'
workflow_call:


jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint-check-all
- run: npm run prettier-check-all
- run: npm run build --if-present
- run: npm test --if-present
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run check-staged
5 changes: 5 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"src/**/*.{js,jsx,json,css,html}": [
"prettier --write"
]
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore fonts
src/fonts
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"trailingComma": "all",
"useTabs": false,
"tabWidth": 2,
"semi": true,
"arrowParens": "avoid"
}
Loading

0 comments on commit 61d3fcb

Please sign in to comment.