Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 2 #778

Open
wants to merge 144 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
c9c8a3c
add exercise 11.1
danggro Oct 17, 2023
52e9a34
add hello.yml
danggro Oct 18, 2023
fa4e6d3
add hello.yml
danggro Oct 18, 2023
3b62c9e
lint
danggro Oct 18, 2023
3429163
fix first errors
danggro Oct 18, 2023
8ab8f62
fix first errors
danggro Oct 18, 2023
e855f87
build n test
danggro Oct 18, 2023
e2b26b6
build n test fixed
danggro Oct 18, 2023
3ec54bc
add end 2 end test
danggro Oct 18, 2023
5125418
add end 2 end test fixed
danggro Oct 18, 2023
c96ec47
add test to e2e test
danggro Oct 18, 2023
56aebe3
deploy
danggro Oct 18, 2023
8232b00
fly deploy 2
danggro Oct 18, 2023
2e476b8
fly deploy 3
danggro Oct 18, 2023
b8555e1
fly deploy 4
danggro Oct 18, 2023
e337cad
fly deploy 5
danggro Oct 18, 2023
cacc015
fly deploy 6
danggro Oct 18, 2023
694dd2f
fly deploy 7
danggro Oct 18, 2023
6d099f4
fly deploy 8
danggro Oct 18, 2023
fb13a2c
deploy render 1
danggro Oct 19, 2023
4c15c4b
deploy render 2
danggro Oct 19, 2023
c2afd49
deploy render 2
danggro Oct 19, 2023
a2db402
deploy render 3
danggro Oct 19, 2023
871a3a0
deploy render 4
danggro Oct 19, 2023
99b8775
deploy render 5
danggro Oct 19, 2023
5acb3db
deploy render 6
danggro Oct 19, 2023
bc99e5c
deploy render 7
danggro Oct 19, 2023
ee446f9
deploy render 8
danggro Oct 19, 2023
af8e563
check secrets
danggro Oct 19, 2023
ec10457
check secrets
danggro Oct 19, 2023
1595eb6
check secrets
danggro Oct 19, 2023
4c35c58
check secrets
danggro Oct 19, 2023
e2839cb
check secrets
danggro Oct 19, 2023
328a3c0
check secrets
danggro Oct 19, 2023
54d268f
check secrets
danggro Oct 19, 2023
94947e3
check secrets
danggro Oct 19, 2023
df0f475
check secrets
danggro Oct 19, 2023
c99c8ed
check secrets
danggro Oct 19, 2023
b073824
check secrets
danggro Oct 19, 2023
157df50
check secrets
danggro Oct 19, 2023
39505ac
check secrets
danggro Oct 19, 2023
d40439e
check secrets
danggro Oct 19, 2023
e85ac95
check secrets
danggro Oct 19, 2023
a392af3
check secrets
danggro Oct 19, 2023
b36e4d9
check secrets
danggro Oct 19, 2023
90d9c5b
check secrets
danggro Oct 19, 2023
f72c04b
check secrets
danggro Oct 19, 2023
f01fbbf
check secrets 2
danggro Oct 19, 2023
6e3f5c9
check secrets 2
danggro Oct 19, 2023
f8bc15b
check secrets 2
danggro Oct 19, 2023
57b1ae7
deploy render 9
danggro Oct 19, 2023
91291d0
deploy render 10
danggro Oct 19, 2023
656fe74
deploy render 11
danggro Oct 19, 2023
2083df2
deploy render error
danggro Oct 19, 2023
81562bd
deploy render 12
danggro Oct 19, 2023
93cbd7e
in feature 2
danggro Oct 19, 2023
e6a38ab
in feature 2(2)
danggro Oct 19, 2023
4d8e8e4
in feature 2(3)
danggro Oct 19, 2023
db61a27
in feature 2(4)
danggro Oct 19, 2023
3b2813b
in feature 2(5)
danggro Oct 19, 2023
7ca0726
Merge pull request #2 from danggro/feature-2
danggro Oct 19, 2023
cffbb2a
in feature 2(6)
danggro Oct 19, 2023
f61d33c
Merge pull request #3 from danggro/feature-2
danggro Oct 19, 2023
e484cb0
add feature in ver 13
danggro Oct 19, 2023
3285fda
Merge pull request #4 from danggro/feature-2
danggro Oct 19, 2023
13719fa
add feature in ver 14
danggro Oct 19, 2023
1864f59
Merge pull request #5 from danggro/feature-2
danggro Oct 19, 2023
8a6111c
versioning 1
danggro Oct 19, 2023
eb7e269
Merge pull request #6 from danggro/feature-2
danggro Oct 19, 2023
59052de
versioning 2
danggro Oct 19, 2023
6a8c98f
Merge pull request #7 from danggro/feature-2
danggro Oct 19, 2023
6496c3b
versioning 3
danggro Oct 19, 2023
e1b86c5
Merge pull request #8 from danggro/feature-2
danggro Oct 19, 2023
b02e935
skip versioning 1
danggro Oct 20, 2023
e386f46
skip versioning 2
danggro Oct 20, 2023
279e3e0
skip versioning 3
danggro Oct 20, 2023
9c3814e
Merge pull request #9 from danggro/feature-2
danggro Oct 20, 2023
6aae765
skip versioning 4
danggro Oct 20, 2023
cb67908
Merge pull request #10 from danggro/feature-2
danggro Oct 20, 2023
0c5ebf3
skip versioning 5
danggro Oct 20, 2023
a649edd
Merge pull request #11 from danggro/feature-2
danggro Oct 20, 2023
6de76c8
pass versioning 5
danggro Oct 20, 2023
a205097
Merge pull request #12 from danggro/feature-2
danggro Oct 20, 2023
3d98e76
pass versioning 7
danggro Oct 20, 2023
872b7af
Merge pull request #13 from danggro/feature-2
danggro Oct 20, 2023
050c62e
pass versioning 8
danggro Oct 20, 2023
41c6346
Merge pull request #14 from danggro/feature-2
danggro Oct 20, 2023
58b3de5
pass versioning 9
danggro Oct 20, 2023
367d447
Merge pull request #15 from danggro/feature-2
danggro Oct 20, 2023
7a8efbb
pass versioning 10
danggro Oct 20, 2023
44c0083
Merge pull request #16 from danggro/feature-2
danggro Oct 20, 2023
7c1fc0f
pass versioning 11
danggro Oct 20, 2023
312d76a
Merge pull request #17 from danggro/feature-2
danggro Oct 20, 2023
42783c4
pass versioning 12
danggro Oct 20, 2023
9d5066c
Merge pull request #18 from danggro/feature-2
danggro Oct 20, 2023
f704baf
pass versioning 13
danggro Oct 20, 2023
03760b0
Merge pull request #19 from danggro/feature-2
danggro Oct 20, 2023
4ade11b
pass versioning 14
danggro Oct 20, 2023
084ed52
Merge pull request #20 from danggro/feature-2
danggro Oct 20, 2023
9a98c71
pass versioning 15
danggro Oct 20, 2023
250cb6f
Merge pull request #21 from danggro/feature-2
danggro Oct 20, 2023
1257621
protection 1
danggro Oct 20, 2023
7a59700
Merge branch 'master' into feature-2
danggro Oct 20, 2023
27111f3
check failure 1
danggro Oct 20, 2023
07a1705
check failure 2
danggro Oct 20, 2023
b87fe55
check failure 3
danggro Oct 20, 2023
ebada62
check failure 4
danggro Oct 20, 2023
c9227f4
check failure 5
danggro Oct 20, 2023
5b00a79
check failure 6
danggro Oct 20, 2023
d474001
check failure 7
danggro Oct 20, 2023
516bbd5
check failure 8
danggro Oct 20, 2023
f76c350
check failure 9
danggro Oct 20, 2023
e6e5439
check failure 10
danggro Oct 20, 2023
2eebf2a
check failure 11
danggro Oct 20, 2023
f90eed3
check failure 12
danggro Oct 20, 2023
1650484
check failure 13
danggro Oct 20, 2023
d359809
check failure 14
danggro Oct 20, 2023
2eef936
check failure 15
danggro Oct 20, 2023
e4f5574
check failure 16
danggro Oct 20, 2023
d141769
check failure 17
danggro Oct 20, 2023
dbe70a1
check failure 18
danggro Oct 20, 2023
c528c1d
check failure 19
danggro Oct 20, 2023
09a17b8
check failure 20
danggro Oct 20, 2023
876e6b3
check failure 21
danggro Oct 20, 2023
8e5a119
check failure 22
danggro Oct 20, 2023
b25245e
check failure 23
danggro Oct 20, 2023
df6ddba
check failure 24
danggro Oct 20, 2023
63e13db
check failure 25
danggro Oct 20, 2023
c043657
check failure 26
danggro Oct 20, 2023
026b646
check failure 27
danggro Oct 20, 2023
ee1a59b
check failure 28
danggro Oct 20, 2023
d7f42ba
check failure 29
danggro Oct 20, 2023
52a2250
check failure 30
danggro Oct 20, 2023
328e4a4
check failure 31
danggro Oct 20, 2023
68a2b98
check failure 32
danggro Oct 20, 2023
c4053be
check failure 33
danggro Oct 20, 2023
68ca1c2
check failure 34
danggro Oct 20, 2023
6b682b4
periodic health check 1
danggro Oct 21, 2023
5bcb04e
periodic health check 2
danggro Oct 21, 2023
c216ea7
periodic health check 3
danggro Oct 21, 2023
577763c
periodic health check 4
danggro Oct 21, 2023
fb6e4b2
periodic health check 5
danggro Oct 21, 2023
f3596cc
periodic health check 6
danggro Oct 22, 2023
80a43f8
periodic health check 7
danggro Oct 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
.gitconfig
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
webpack.config.js
node_modules/
dist/
cypress.config.js
69 changes: 25 additions & 44 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,30 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
env: {
browser: true,
es6: true,
'jest/globals': true,
node: true,
'cypress/globals': true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
extends: ['eslint:recommended', 'plugin:react/recommended'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"ecmaVersion": 2018,
"sourceType": "module"
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react', 'jest', 'cypress'],
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never'],
eqeqeq: 'error',
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
'no-console': 0,
'react/prop-types': 0,
},
"plugins": [
"react", "jest"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
],
"eqeqeq": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": [
"error", "always"
],
"arrow-spacing": [
"error", { "before": true, "after": true }
],
"no-console": "error",
"react/prop-types": 0
}
}
79 changes: 79 additions & 0 deletions .github/workflows/deploy_render.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deployment to Render

on:
push:
branches:
- master
# note that your "main" branch might be called main instead of master
pull_request:
branches: [master]
types: [opened, synchronize]

jobs:
simple_deployment_pipeline:
name: Build & Deploy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: npm install

- name: Check style
run: npm run eslint

- name: Build
run: npm run build

- name: Notif Fail to Discord
uses: rjstone/discord-webhook-notify@v1
if: ${{failure() && github.event_name == 'push'}}
with:
severity: error
description: commit
details: '${{ github.event.head_commit.url}} by ${{ github.actor}} broke the build :('
text: Build failed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

- name: Test
run: npm run test

- name: e2e tests
uses: cypress-io/github-action@v5
with:
command: npm run test:e2e
start: npm run start-prod
wait-on: http://localhost:5000

- name: Deploy to Render
if: ${{ github.event_name == 'push' && !contains(toJson(join(github.event.commits.*.message, ', ')), '#skip')}}
env:
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: curl "$deploy_url"

tag-release:
name: Versioning
needs: [simple_deployment_pipeline]
runs-on: ubuntu-20.04
permissions:
contents: write
if: ${{ github.event_name == 'push' && !contains(toJson(join(github.event.commits.*.message, ', ')), '#skip')}}

steps:
- uses: actions/checkout@v3
- name: Bump version and push tag
uses: anothrNick/github-tag-action@a2c70ae13a881faf2b4953baaa9e49731997ab36
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
- name: Notif Success to Discord
uses: rjstone/discord-webhook-notify@v1
if: ${{success() && github.event_name == 'push'}}
with:
severity: info
description: 'to ${{github.event.repository.homepage}} by ${{ github.actor}}'
text: A new version of Pokedex deployed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
30 changes: 30 additions & 0 deletions .github/workflows/periodic_health_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Periodic Check Health
on:
schedule:
- cron: '00 14 * * *'

jobs:
health_check:
runs-on: ubuntu-20.04
steps:
- name: Check the deployed service URL
uses: jtalk/url-health-check-action@v3
with:
# Check the following URLs one by one sequentially
url: https://pokedex-danggro.onrender.com/
# Follow redirects, or just report success on 3xx status codes
follow-redirect: false # Optional, defaults to "false"
# Fail this action after this many failed attempts
max-attempts: 3 # Optional, defaults to 1
# Delay between retries
retry-delay: 10s # Optional, only applicable to max-attempts > 1

- name: Notif Fail to Discord
uses: rjstone/discord-webhook-notify@v1
if: ${{failure()}}
with:
severity: error
description: error connect to
details: '${{github.event.repository.homepage}}'
text: Periodic Health Check
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dist/
node_modules/
node_modules/
.gitconfig
makefile
21 changes: 15 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const express = require("express");
const app = express();
const express = require('express')
const app = express()

// Heroku dynamically sets a port
const PORT = process.env.PORT || 5000;
const PORT = process.env.PORT || 5000

app.use(express.static("dist"));
app.use(express.static('dist'))

app.get('/version', (req, res) => {
res.send('check failure 19')
// res.send('in branch feature')
})

app.get('/health', (req, res) => {
res.send('ok')
})

app.listen(PORT, () => {
console.log("server started on port 5000");
});
console.log('server started on port 5000')
})
5 changes: 5 additions & 0 deletions build_step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "Build script"

# add the commands here
9 changes: 9 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
})
14 changes: 14 additions & 0 deletions cypress/e2e/e2etest.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('Pokedex', function () {
it('front page can be opened', function () {
cy.visit('http://localhost:5000')
cy.contains('ivysaur')
cy.contains(
'Pokémon and Pokémon character names are trademarks of Nintendo.'
)
})
it('can navigate to particular pokemon', function () {
cy.visit('http://localhost:5000')
cy.contains('ivysaur').click()
cy.contains('chlorophyll')
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
5 changes: 5 additions & 0 deletions exercise1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Tool for linting javascript code is ESLint. ESLint is an open source JavaScript linting utility originally created by Nicholas C. Zakas in June 2013. Code linting is a type of static analysis that is frequently used to find problematic patterns or code that doesn’t adhere to certain style guidelines. There are code linters for most programming languages, and compilers sometimes incorporate linting into the compilation process. Tool for testing javascript code is Jest. Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!. Tools for build javascript code is Webpack. webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph from one or more entry points and then combines every module your project needs into one or more bundles, which are static assets to serve your content from.

Beside Jenkins and Github Actions there are Travis CI, TeamCity, Bamboo, GitLab, Azure Pipelines, CircleCI, Bitbucket Pieplines.

This application will setup in a self-hosted environment, it because we use more than 1 language and many people involved. It's better to configure the setup to be flexible that can make people easier to deploy his code.
Loading