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

Update ci trigger #227

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 4 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
"jest/globals": true,
"node": true,
},
"extends": [
"eslint:recommended",
Expand All @@ -20,21 +21,12 @@ module.exports = {
],
"rules": {
"indent": [
"error",
2
],
"error",2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
],
"eqeqeq": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": [
Expand All @@ -43,7 +35,6 @@ module.exports = {
"arrow-spacing": [
"error", { "before": true, "after": true }
],
"no-console": "error",
"react/prop-types": 0
}
}
20 changes: 20 additions & 0 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Hello World!

on:
push:
branches:
- main

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
32 changes: 32 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deployment pipeline

on:
push:
branches:
- main
pull_request:
branches: [main]
types: [opened, synchronize]

jobs:
simple_deployment_pipeline:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Check style
run: npm run eslint
- name: build the project
run : npm run build
- name: test the project
run : npm run test
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run e2e:test
- name: Trigger deployment
run: curl https://api.render.com/deploy/srv-${{secrets.RENDER_SERVICE_ID}}?key=${{secrets.RENDER_API_KEY}}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
dist/
node_modules/
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
7 changes: 7 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ const app = express();
const PORT = process.env.PORT || 5000;

app.use(express.static("dist"));
app.get('/version', (_req, res) => {
res.send('3') // 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 ${PORT}`);
});
5 changes: 5 additions & 0 deletions build_step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/ban

echo "Build script"
npm install
npm run build
9 changes: 9 additions & 0 deletions e2e-tests/example.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { test, describe, expect, } = require('@playwright/test')

describe('Pokedex', () => {
test('front page can be opened', async ({ page }) => {
await page.goto('http://localhost:5000')
await expect(page.getByText('ivysaur')).toBeVisible()
await expect(page.getByText('Pokémon and Pokémon character names are trademarks of Nintendo.')).toBeVisible()
})
})
Loading