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

Test #833

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

Test #833

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
3ba7711
Create hello.yml
arifariofficial Dec 16, 2023
22f98aa
hello.yml
arifariofficial Dec 16, 2023
da24373
Update hello.yml
arifariofficial Dec 16, 2023
080930c
Update hello.yml
arifariofficial Dec 16, 2023
c9808ef
Update hello.yml
arifariofficial Dec 16, 2023
d076456
Update hello.yml
arifariofficial Dec 16, 2023
65f4524
Create pipeline.yml
arifariofficial Dec 16, 2023
100cfef
Create pipline.yml
arifariofficial Dec 16, 2023
8de8e5e
Delete .github/workflows/pipeline.yml
arifariofficial Dec 16, 2023
dacfea2
Rename pipline.yml to pipeline.yml
arifariofficial Dec 16, 2023
ac66d2c
Delete .github/workflows/pipeline.yml
arifariofficial Dec 16, 2023
7d06eec
Create pipeline.yml
arifariofficial Dec 16, 2023
3862a11
Update pipeline.yml
arifariofficial Dec 16, 2023
b53d802
fix lint errors
arifariofficial Dec 16, 2023
381902a
Merge branch 'master' of https://github.com/arifariofficial/full-stac…
arifariofficial Dec 16, 2023
54cf705
fix lint errors
arifariofficial Dec 16, 2023
4062b71
Update pipeline.yml
arifariofficial Dec 16, 2023
8cb859c
Update pipeline.yml
arifariofficial Dec 16, 2023
4a435ec
Update pipeline.yml
arifariofficial Dec 16, 2023
0a11bf0
Update pipeline.yml
arifariofficial Dec 16, 2023
a1ee666
Update pipeline.yml
arifariofficial Dec 16, 2023
c616fb9
Update pipeline.yml
arifariofficial Dec 16, 2023
6664399
text fixed
arifariofficial Dec 16, 2023
7d1e69b
Merge branch 'master' of https://github.com/arifariofficial/full-stac…
arifariofficial Dec 16, 2023
512ac98
Update pipeline.yml
arifariofficial Dec 16, 2023
a4fc4f4
cypress updated
arifariofficial Dec 16, 2023
b76706a
Merge branch 'master' of https://github.com/arifariofficial/full-stac…
arifariofficial Dec 16, 2023
67430fd
cy lint updated
arifariofficial Dec 16, 2023
ed044c4
fixed lint cypress problem
arifariofficial Dec 16, 2023
271d830
Update pipeline.yml
arifariofficial Dec 16, 2023
05916de
update pipeline
arifariofficial Dec 17, 2023
bc1bdcd
Merge branch 'master' of https://github.com/arifariofficial/full-stac…
arifariofficial Dec 17, 2023
bafccbe
update pipeline
arifariofficial Dec 17, 2023
0763d4b
update pipeline
arifariofficial Dec 17, 2023
310762e
update pipeline
arifariofficial Dec 17, 2023
075b793
update pipeline
arifariofficial Dec 17, 2023
20a2207
udpate pipeline
arifariofficial Dec 17, 2023
30ee79e
update pipeline
arifariofficial Dec 17, 2023
7a17467
updated fly
arifariofficial Dec 17, 2023
2139e09
updated fly
arifariofficial Dec 17, 2023
3b939a8
update fly
arifariofficial Dec 17, 2023
de09292
not ok
arifariofficial Dec 17, 2023
8a7674c
no health check endpoint
arifariofficial Dec 17, 2023
7c4a525
update
arifariofficial Dec 17, 2023
7a37ff5
make it better
arifariofficial Dec 17, 2023
817a726
heroku
arifariofficial Dec 17, 2023
7e90a4a
fixed Procfile
arifariofficial Dec 17, 2023
b4b6db0
health check
arifariofficial Dec 17, 2023
df18f92
ok
arifariofficial Dec 17, 2023
7a9a380
fixed url
arifariofficial Dec 17, 2023
7c4f52d
rollback added
arifariofficial Dec 17, 2023
a14d13b
fixed again
arifariofficial Dec 17, 2023
628e842
a new branch
arifariofficial Dec 17, 2023
bb6036a
added if to pipeline
arifariofficial Dec 17, 2023
c1483a2
versioning
arifariofficial Dec 18, 2023
66f6048
Merge branch 'master' into test
arifariofficial Dec 18, 2023
ccf486e
Merge pull request #1 from arifariofficial/test
arifariofficial Dec 18, 2023
9322e5f
tag naming
arifariofficial Dec 18, 2023
f0c6908
Merge pull request #2 from arifariofficial/test
arifariofficial Dec 18, 2023
722b9a7
skip
arifariofficial Dec 18, 2023
adaa3d4
Merge branch 'master' of https://github.com/arifariofficial/full-stac…
arifariofficial Dec 18, 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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
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
67 changes: 23 additions & 44 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
env: {
browser: true,
node: true,
es6: true,
"jest/globals": true,
"cypress/globals": true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
extends: ["eslint:recommended", "plugin:react/recommended", "plugin:cypress/recommended"],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"ecmaVersion": 2018,
"sourceType": "module"
ecmaVersion: 2018,
sourceType: "module",
},
"plugins": [
"react", "jest"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
],
"eqeqeq": "error",
plugins: ["react", "jest", "cypress"],
rules: {
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
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
}
}
"object-curly-spacing": ["error", "always"],
"arrow-spacing": ["error", { before: true, after: true }],
"no-console": "off",
"react/prop-types": 0,
},
};
21 changes: 21 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Hello World!

on:
push:
branches:
- master

jobs:
hello_world_job:
runs-on: ubuntu-20.04

steps:
- name: Say hello
run: |
echo "Hello world!"
- name: Now it is
run: |
date
- name: Directory content
run: |
ls -l
60 changes: 60 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deployment pipeline

on:
push:
branches:
- master

pull_request:
branches: [master]
types: [opened, synchronize]

jobs:
simple_deployment_pipeline:
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: lint
run: npm run eslint

- name: build
run: npm run build

- 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 heroku
if: ${{github.event_name == 'push'}}
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "full-stack-open-pokedex-ariful"
heroku_email: "[email protected]"
healthcheck: "https://full-stack-open-pokedex-ariful-694d15d9d278.herokuapp.com/health"
checkstring: "ok"
rollbackonhealthcheckfailed: true

tag_realease:
if: ${{github.event_name == 'push' && !contains(join(toJson(github.event.commits.message)), 'skip')}}
needs: [simple_deployment_pipeline]
runs-on: ubuntu-20.04
steps:
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
WITH_V: true
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=16.20.2
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Node.js"

# Node.js app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python

# Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci --include=dev

# Copy application code
COPY --link . .

# Build application
RUN npm run build

# Remove development dependencies
RUN npm prune --omit=dev


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "node", "src/index.js" ]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run start-prod
10 changes: 9 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ const PORT = process.env.PORT || 5000;

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

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

app.get("/version", (req, res) => {
res.send("1"); // change this string to ensure a new version deployed
});

app.listen(PORT, () => {
console.log("server started on port 5000");
console.log(`server started on port ${PORT}`);
});
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
},
},
});
13 changes: 13 additions & 0 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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("navigate to particular pokeman", () => {
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')
Loading