Skip to content

Commit

Permalink
test: Set up basic unit test infrastructure; refactor: Move global wi…
Browse files Browse the repository at this point in the history
…ndow declaration to dedicated file in src folder
  • Loading branch information
Michal Wiraszka committed Jul 1, 2024
1 parent 96c18a4 commit 641dde0
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 119 deletions.
50 changes: 18 additions & 32 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,39 @@ on:
- main

jobs:
# Build:
# runs-on: ubuntu-latest
# steps:
# - name: Check out GitHub branch
# uses: actions/checkout@v4

# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 20

# - name: Set up GitHub action
# uses: pnpm/action-setup@v3
# with:
# version: 9

# - name: Install dependencies
# run: pnpm install --frozen-lockfile

# - name: Build Angular project
# run: pnpm run build

# Test:
# needs: [Build]
# runs-on: ubuntu-latest
# steps:
# - name: Run unit tests
# run: pnpm run test

Deploy-Preview:
# needs: [Build]
Build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub branch
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Set up GitHub action
uses: pnpm/action-setup@v3
with:
version: 9

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build Angular project
run: pnpm run build

Test:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: Run unit tests
run: pnpm run test

Update-S3-Bucket:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
31 changes: 15 additions & 16 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
Test:
Build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub branch
Expand All @@ -21,31 +21,30 @@ jobs:
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install packages for test environment

- name: Install dependencies
run: pnpm install --frozen-lockfile

# - name: Run unit tests
# run: pnpm run test
- name: Build Angular project
run: pnpm run build

Deploy-Preview:
needs: [Test]
Test:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: Check out GitHub branch
uses: actions/checkout@v4

- name: Set up GitHub action
uses: pnpm/action-setup@v3
with:
version: 9
- name: Run unit tests
run: pnpm run test

Update-S3-Bucket:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Copy to AWS S3 bucket
run: aws s3 sync dist/ s3://lcc-website-production --delete
run: aws s3 sync dist/ s3://lcc-website-production --delete
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ Welcome to the source code repository for the new LCC website! Here you'll find
- `S3` for static web hosting and image storage
- `Route 53` for DNS and traffic management
- `DynamoDB` for a NoSQL database system
- `CodeBuild` for configuring the build process and CI/CD pipeline
- `API Gateway` for API management and routing
- `Cognito & IAM` for user authentication
- `Lambda` for serverless backend functions
- `CloudFront` for content delivery
- `EC2` for running an Express.js server, responsible for article image CRUD operations

> DEV OPS
- `GitHub Actions` for automated workflows to build project, run unit tests, and deploy preview & production versions of the website

## Release notes

| | |
Expand All @@ -40,10 +43,10 @@ Welcome to the source code repository for the new LCC website! Here you'll find

<details>
<summary style="cursor: pointer">
v4.0.4 - June 30th, 2024
v4.0.4 - July 2nd, 2024
</summary>

- 🔧 Switch to `pnpm` and set up separate GitHub workflows for preview and production websites
- 🔧 Switch to `pnpm` and set up dedicated GitHub Actions workflows for preview and production static hosting buckets on S3
- 🔧 Set up basic unit tests

</details>
Expand Down
6 changes: 2 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"browser": ""
},
"index": "src/index.html",
"polyfills": ["zone.js"],
"polyfills": ["zone.js", "window-global-fix.ts"],
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"],
Expand Down Expand Up @@ -163,10 +163,8 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": "zone.js",
"polyfills": ["zone.js", "window-global-fix.ts"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"],
"scripts": [
"node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js",
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@angular/compiler-cli": "^18.0.4",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/google.maps": "^3.55.7",
"@types/jasmine": "~3.10.0",
"@types/jasmine": "~5.1.0",
"@types/node": "^20.11.5",
"@types/remove-markdown": "^0.3.4",
"@types/uuid": "^9.0.5",
Expand All @@ -70,12 +70,12 @@
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"prettier": "^2.8.7",
"prettier-eslint": "^15.0.1",
"typescript": "5.4.5",
Expand Down
Loading

0 comments on commit 641dde0

Please sign in to comment.