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

Newest #703

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9aaf80c
First
mutlr Jul 17, 2023
190edb7
yml
mutlr Jul 17, 2023
383ffbe
yml
mutlr Jul 17, 2023
ef6b2fa
Update hello.yml
mutlr Jul 17, 2023
b0036d2
Update hello.yml
mutlr Jul 17, 2023
0e47aa6
yml
mutlr Jul 17, 2023
d3a4c3e
Merge branch 'master' of github.com:mutlr/full-stack-open-pokedex
mutlr Jul 17, 2023
16901e3
yml
mutlr Jul 17, 2023
394b3d5
yml
mutlr Jul 17, 2023
091853b
yml
mutlr Jul 17, 2023
043bce2
yml
mutlr Jul 17, 2023
d70692a
yml
mutlr Jul 17, 2023
74cc062
11.7
mutlr Jul 17, 2023
12dc625
11.7
mutlr Jul 17, 2023
52e245c
11.9
mutlr Jul 17, 2023
e44dd92
11.9
mutlr Jul 17, 2023
9d6a5e7
11.9
mutlr Jul 18, 2023
b570724
11.9
mutlr Jul 18, 2023
5989d5a
Test
mutlr Jul 18, 2023
cf4580d
Test
mutlr Jul 18, 2023
0d18fa4
Test
mutlr Jul 18, 2023
2b1fc4a
not my secrets..
mutlr Jul 18, 2023
e2a85c8
Does not deploy if tests fail
mutlr Jul 18, 2023
6da37bc
11.11
mutlr Jul 18, 2023
1d08353
11.11
mutlr Jul 18, 2023
a352b52
11.12
mutlr Jul 18, 2023
8ede29c
11.12
mutlr Jul 18, 2023
ff810e5
11.11
mutlr Jul 18, 2023
5807264
11.12 should not deploy
mutlr Jul 18, 2023
66f9bfc
11.12 should deploy
mutlr Jul 18, 2023
d86047e
11.12 should not deploy
mutlr Jul 18, 2023
b0e2406
11.12 should not deploy
mutlr Jul 18, 2023
e9ce97b
11.12 should deploy
mutlr Jul 18, 2023
363912a
11.12 should not deploy
mutlr Jul 18, 2023
a898e0e
11.12 should not deploy
mutlr Jul 18, 2023
ead6979
11.12 should deploy
mutlr Jul 18, 2023
486e5d6
Testing branching
mutlr Jul 18, 2023
1229fd6
Test branch
mutlr Jul 18, 2023
3b26671
Test for not doing deployment for pull request
mutlr Jul 18, 2023
34c90a4
Merge pull request #1 from mutlr/test
mutlr Jul 18, 2023
e3ec26c
Versioning
mutlr Jul 18, 2023
645d337
Merge pull request #2 from mutlr/test
mutlr Jul 18, 2023
40dc321
Versioning 2
mutlr Jul 18, 2023
acfafae
Merge pull request #3 from mutlr/test
mutlr Jul 18, 2023
36bd659
Versioning 2
mutlr Jul 18, 2023
54dbe43
Merge pull request #4 from mutlr/test
mutlr Jul 18, 2023
aca72d8
Newest
mutlr Jul 18, 2023
68037a4
Newest
mutlr Jul 18, 2023
f94139a
Newest
mutlr Jul 18, 2023
708cf6d
...mixed
mutlr Jul 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
13 changes: 10 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"es6": true,
"jest/globals": true
"jest/globals": true,
"cypress/globals": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
"plugin:react/recommended",
],
"parserOptions": {
"ecmaFeatures": {
Expand All @@ -16,7 +18,7 @@ module.exports = {
"sourceType": "module"
},
"plugins": [
"react", "jest"
"react", "jest", "cypress"
],
"rules": {
"indent": [
Expand Down Expand Up @@ -45,5 +47,10 @@ module.exports = {
],
"no-console": "error",
"react/prop-types": 0
},
"settings": {
"react": {
"version": "detect"
}
}
}
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
# note that your "main" branch might be called main instead of 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
53 changes: 53 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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: Check style
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
build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs: [simple_deployment_pipeline]
steps:
- name: Deploy to production
uses: johnbeynon/[email protected]
with:
service-id: ${{ secrets.RENDER_SERVICE_ID }}
api-key: ${{ secrets.RENDER_API_KEY }}
tag_release:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' }}
needs: [build, simple_deployment_pipeline]
steps:
- uses: actions/checkout@v3
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist/
node_modules/
node_modules/
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('24') // change this string to ensure a new version deployed
})

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

app.listen(PORT, () => {
console.log("server started on port 5000");
});
// eslint-disable-next-line no-console
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"
npm install
npm run build
10 changes: 10 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// eslint-disable-next-line no-unused-vars
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
})
17 changes: 17 additions & 0 deletions cypress/e2e/pokemon.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Pokedex', function() {
beforeEach(function() {
cy.visit('http://localhost:5000')
})
it('front page can be opened', function() {
cy.contains('ivysaur')
cy.contains('Pokémon and Pokémon character names are trademarks of Nintendo.')
})
it('Navigation works', () => {
cy.contains('ivysaur')
cy.contains('kakuna').click()
cy.contains('ivysaur').should('not.exist')
cy.contains('Next').click()
cy.contains('kakuna').should('not.exist')
cy.contains('beedrill')
})
})
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"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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')
Binary file added cypress/videos/pokemon.cy.js.mp4
Binary file not shown.
31 changes: 31 additions & 0 deletions exercise1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
In the JavaScript ecosystem, specific tools cater to the common steps in a CI setup.

For linting, ESLint is a popular choice that analyzes JavaScript code for errors, enforces coding styles, and ensures consistency across the codebase.

When it comes to testing, Cypress is widely used for end-to-end testing of modern web applications. It provides a feature-rich framework with a powerful API, real-time reloading, and easy debugging.

For building JavaScript applications, Webpack is a popular bundler that handles dependency management, asset loading, and code optimization for production deployments.

Besides Jenkins and GitHub Actions, alternative CI tools like Travis CI and CircleCI exist. Travis CI is a cloud-based service that integrates seamlessly with GitHub repositories, offering simple setup and support for test execution and deployments. CircleCI provides both cloud-based and self-hosted options, featuring parallel workflows, dependency caching, and flexible configuration.

Deciding between a self-hosted or cloud-based environment depends on factors like budget, infrastructure requirements, and team expertise. As a beginner, a cloud-based solution may be more practical, eliminating the need for infrastructure management, providing scalability, and comprehensive documentation and support.

To make an informed decision, consider project size, budget constraints, infrastructure capabilities, and the team's familiarity with self-hosted environments. Weighing these factors helps determine whether a cloud-based or self-hosted setup is more suitable for the JavaScript application's CI pipeline.



In the world of JavaScript, there are these tools that you can use for setting up CI stuff.

For checking code errors and making sure everything looks good there's ESLint. It looks at your JavaScript code, finds mistakes and keeps things consistent.

When it comes to testing, there's a testing library called Cypress. It's all about testing your web apps from start to finish. It has a bunch of cool features like an easy interface, real-time reloading, and making it really easyu to figure out what went wrong.

Then there's Webpack for building your JavaScript apps. It handles all the complex things like managing dependencies and optimizing your code so that it runs fast when it's out in the real world.

Now, apart from Jenkins and GitHub Actions, there are some other tools you can use for CI. Like Travis CI, it's a cloud based tool that works nicely with your GitHub projects. It helps you run tests and deploy your app to different places.

Another option is CircleCI. They have both cloud and self-hosted options. It's got cool features like running things in parallel and caching stuff to make things faster.

Now, when it comes to choosing between a self-hosted or cloud-based setup, it can be confusing. As a beginner, it might be easier to go with a cloud-based option. You don't have to worry about setting up your own servers and stuff. Also they usually have good documentation and support to help you out.

To decide, think about things like how big your project is, how much money you have and how good you are with setting up and maintaining servers. These things will help you figure out whether a cloud-based or self-hosted setup is better for your CI stuff.
Loading