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

Branch test #813

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
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
3b015d9
Create hello.yml
rr-tri Nov 28, 2023
f01a28d
11.4 Date and directory contents
rr-tri Nov 28, 2023
34d69dc
Linting workflow
rr-tri Nov 28, 2023
57e3373
Fix the code
rr-tri Nov 28, 2023
264a66b
Revert "Fix the code"
rr-tri Nov 28, 2023
99f89aa
fix code
rr-tri Nov 28, 2023
e52d0d4
Update pipeline.yml
rr-tri Nov 28, 2023
267bc54
Update PokemonPage.jsx
rr-tri Nov 28, 2023
5e07381
Simple end to end tests check
rr-tri Nov 28, 2023
ad5229e
setup cypress properly
rr-tri Nov 28, 2023
84132b1
Update cypress.config.js
rr-tri Nov 28, 2023
a98b538
Simple end to end tests
rr-tri Nov 28, 2023
b64b37f
deploy to render
rr-tri Nov 28, 2023
bf56e4e
Update app.js
rr-tri Nov 28, 2023
0fe235f
health check api
rr-tri Nov 28, 2023
55507b2
Update pipeline.yml
rr-tri Nov 28, 2023
d2499b6
Update pipeline.yml
rr-tri Nov 28, 2023
d0b311b
diploy check
rr-tri Nov 28, 2023
8c11726
update deploy yml
rr-tri Nov 28, 2023
a864fa5
Update pipeline.yml
rr-tri Nov 28, 2023
07446a9
Update pipeline.yml
rr-tri Nov 28, 2023
27f3589
Update pipeline.yml
rr-tri Nov 28, 2023
2971ce6
Update pipeline.yml
rr-tri Nov 28, 2023
f9430ef
Update pipeline.yml
rr-tri Nov 29, 2023
19071fe
Update app.js
rr-tri Nov 29, 2023
966e545
Update pipeline.yml
rr-tri Nov 30, 2023
fa81280
version update from branch
rr-tri Nov 30, 2023
3df7ce8
Merge pull request #2 from rr-tri/branchTest
rr-tri Nov 30, 2023
6db274e
Update pipeline.yml
rr-tri Nov 30, 2023
b23866d
Merge pull request #3 from rr-tri/branchTest
rr-tri Nov 30, 2023
f510aab
Update pipeline.yml
rr-tri Nov 30, 2023
776d8e5
Merge pull request #4 from rr-tri/branchTest
rr-tri Nov 30, 2023
b4b9990
Update app.js
rr-tri Nov 30, 2023
9619a99
Merge pull request #5 from rr-tri/branchTest
rr-tri Nov 30, 2023
f381111
Update app.js
rr-tri Dec 1, 2023
fab59c7
Merge pull request #6 from rr-tri/branchTest
rr-tri Dec 1, 2023
e8ceb4e
Update pipeline.yml
rr-tri Dec 1, 2023
7906685
Merge pull request #7 from rr-tri/branchTest
rr-tri Dec 1, 2023
e18e27e
Update pipeline.yml
rr-tri Dec 1, 2023
809f1bd
Update pipeline.yml
rr-tri Dec 1, 2023
8ac7800
Merge pull request #8 from rr-tri/branchTest
rr-tri Dec 1, 2023
1b78655
specify the used version with hash instead of using a version number
rr-tri Dec 1, 2023
2a10b88
Merge pull request #9 from rr-tri/branchTest
rr-tri Dec 1, 2023
97ee4cc
discord notification test
rr-tri Dec 1, 2023
ca7bc04
Merge pull request #10 from rr-tri/branchTest
rr-tri Dec 1, 2023
cfd3a44
Update pipeline.yml
rr-tri Dec 1, 2023
5b09407
Merge pull request #11 from rr-tri/branchTest
rr-tri Dec 1, 2023
985d0ea
Update pipeline.yml
rr-tri Dec 1, 2023
a71e6f1
Merge pull request #12 from rr-tri/branchTest
rr-tri Dec 1, 2023
92c0271
Update pipeline.yml
rr-tri Dec 1, 2023
bce5f03
Update pipeline.yml
rr-tri Dec 1, 2023
62a343f
Merge pull request #13 from rr-tri/branchTest
rr-tri Dec 1, 2023
3b0d9a8
Create schedule.yml
rr-tri Dec 1, 2023
ffc4318
Merge pull request #14 from rr-tri/branchTest
rr-tri Dec 1, 2023
5232eeb
Update schedule.yml
rr-tri Dec 1, 2023
6d09ccf
healthcheck
rr-tri Dec 1, 2023
65eb249
Merge pull request #15 from rr-tri/branchTest
rr-tri Dec 1, 2023
ac5f6eb
Update schedule_healthcheck.yml
rr-tri Dec 7, 2023
b796eb5
Merge pull request #16 from rr-tri/rr-tri-patch-1
rr-tri Dec 7, 2023
657f74e
Create exercise1.md
rr-tri Dec 9, 2023
672fad3
Merge branch 'master' into branchTest
rr-tri Dec 9, 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: 8 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
"jest/globals": true,
"node": true

},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
"plugin:react/recommended",
"plugin:cypress/recommended"
],
"parserOptions": {
"ecmaFeatures": {
Expand All @@ -16,13 +19,13 @@ module.exports = {
"sourceType": "module"
},
"plugins": [
"react", "jest"
"react", "jest", "cypress"
],
"rules": {
"indent": [
"error",
2
],
2
],
"linebreak-style": [
"error",
"unix"
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
67 changes: 67 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

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 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: Trigger deployment
if: ${{ github.event_name == 'push' }}
run: curl https://api.render.com/deploy/srv-${{secrets.RENDER_SERVICE_ID}}?key=${{secrets.RENDER_API_KEY}}
tag_release:
needs: [simple_deployment_pipeline]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:

- name: Checkout Repository
uses: actions/checkout@v2
- name: Bump version and push tag
if: ${{ github.event_name == 'push' }}

uses: anothrNick/github-tag-action@8c8163ef62cf9c4677c8e800f36270af27930f42
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Deployment Success
uses: rjstone/discord-webhook-notify@v1

if: github.event_name == 'push' && success()
with:
severity: info
text: A new version of pokedex deployed.
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

- name: Notify Deployment Failure and Show Commit Info
uses: rjstone/discord-webhook-notify@v1
if: failure()

with:
severity: error
text: Build failed!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

19 changes: 19 additions & 0 deletions .github/workflows/schedule_healthcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# name: Periodic Health Check

# on:
# schedule:
# - cron: '0 0 * * *' # Schedule the workflow to run every 24 hours

# jobs:
# health_check:
# runs-on: ubuntu-latest
# steps:
# - name:
# run : echo "This step will run on every one minute"
# - name: Perform Health Check
# uses: jtalk/url-health-check-action@v3
# with:
# url: 'https://full-stack-open-pokedex-7vtq.onrender.com'
# follow-redirect: false
# max-attempts: 3
# retry-delay: 5s
20 changes: 13 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
const express = require("express");
const app = express();
/* eslint-disable no-console */
const express = require('express')
const app = express()

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

app.use(express.static("dist"));
const PORT = process.env.PORT || 5000
app.get('/version', (req, res) => {
res.send('1') // change this string to ensure a new version deployed
})
app.get('/health', (req, res) => {
res.send('ok')
})
app.use(express.static('dist'))

app.listen(PORT, () => {
console.log("server started on port 5000");
});
console.log('server started on port 5000')
})
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
},
},
})
19 changes: 19 additions & 0 deletions cypress/e2e/Pokedex.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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.')
})
})
describe('Pokemon Page can be navigated to', () => {
it('Navigates to Ivysaur page and checks for chlorophyll ability', () => {
// Visit the main page
cy.visit('http://localhost:5000/')

// Find and click on the link for Ivysaur
cy.contains('ivysaur').click()

// Wait for the page to load and check for the presence of chlorophyll ability
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')
24 changes: 24 additions & 0 deletions exercise1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# `Exercise 1`

`In a hypothetical scenario where a team of six is actively developing an application, let's consider a language like Python for the project.`

## CI Steps in Python Ecosystem:

1. Linting: For Python, flake8 and pylint are commonly used tools for code linting. These tools help maintain code quality by checking for style issues, errors, and potential bugs.
2.Testing: pytest and unittest are popular testing frameworks in Python. They allow developers to write and execute tests to ensure the application's functionality.
2. Building: Python projects might use tools like setuptools or poetry to manage dependencies and package the application for distribution.

## Alternatives to Jenkins and GitHub Actions:

1. Travis CI: A cloud-based CI/CD service supporting various languages and offering ease of integration with GitHub repositories.
2. CircleCI: Another cloud-based CI/CD platform providing flexibility in configuring pipelines and supporting Python projects among others.
3. GitLab CI/CD: Integrated within GitLab, offering self-hosted and cloud-based options, enabling CI/CD pipelines for Python projects.

## Self-hosted vs. Cloud-based CI Environment:

1. Decision Factors: Considerations such as team expertise, infrastructure costs, scalability needs, and maintenance efforts.
2. Self-hosted: Offers greater control over the CI environment, suitable for specialized requirements or strict security policies.
3. Cloud-based: Provides ease of setup, scalability, and maintenance handled by the service provider, suitable for teams focusing on rapid development and deployment.

`To decide between self-hosted or cloud-based CI, gather information on the team's expertise in managing infrastructure, budget constraints, security needs, and scalability requirements.
A self-hosted setup might be beneficial for stringent security needs or specialized configurations, while a cloud-based environment might suit teams focusing on agility and cost-effectiveness.`
Loading