Skip to content

Commit

Permalink
Merged PR 14652: Release
Browse files Browse the repository at this point in the history
- Added LICENSE.txt
- GB3-1647: Add GH actions
  • Loading branch information
Tugark committed Sep 3, 2024
2 parents dce0399 + a04c2ed commit 88ba519
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 145 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
"eqeqeq": [2, "smart"],
"semi": "error",
"prefer-template": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "error"
"@typescript-eslint/switch-exhaustiveness-check": "error",
"no-console": ["warn", {"allow": ["warn", "error"]}]
}
},
{
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: GB3 Frontend

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
node:
name: Node
uses: ./.github/workflows/node-tests.yml
with:
cache_key: node-coverage-report-${{ github.sha }}-${{ github.run_id }}
docker:
name: Docker Dry Run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gisktzh/github-actions/docker-dry-run@main
with:
image: gb3-frontend
sonarcloud:
name: SonarCloud
needs: node
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gisktzh/github-actions/sonarcloud-analysis@main
with:
sonar_token: ${{ secrets.SONAR_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_file_path: './coverage/gb3-frontend/lcov.info'
coverage_cache_key: node-coverage-report-${{ github.sha }}-${{ github.run_id }}
deploy-dev:
name: Deploy dev environment
if: github.ref == 'refs/heads/develop'
needs:
- node
- sonarcloud
- docker
uses: ./.github/workflows/node-deploy.yml
46 changes: 46 additions & 0 deletions .github/workflows/node-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to GH Pages

on: workflow_call

env:
NODE_VERSION: '20'

jobs:
build:
name: Build app
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ env.NODE_VERSION }}

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies and build
env:
APP_RELEASE: 'EBP Dev Release'
run: |
npm ci
npm run build-dev-ebp
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist/browser
deploy:
name: Deploy to GH pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
37 changes: 37 additions & 0 deletions .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run tests

on:
workflow_call:
inputs:
cache_key:
description: 'Cache key for coverage report'
required: true
type: string

env:
NODE_VERSION: '20'

jobs:
build-and-test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ env.NODE_VERSION }}

- name: Cache coverage report
uses: actions/cache@v4
with:
path: './coverage/gb3-frontend/lcov.info'
key: ${{ inputs.cache_key }}

- name: Install dependencies and run tests
run: |
npm ci
npm run test-ci
28 changes: 28 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, Amt für Raumentwicklung Kanton Zürich

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
"style": "scss",
"skipTests": true
}
},
"root": "",
Expand Down
Loading

0 comments on commit 88ba519

Please sign in to comment.