-
-
Notifications
You must be signed in to change notification settings - Fork 52
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-36] Create CI/CD pipeline with build-deploy steps #36
Open
davorpa
wants to merge
12
commits into
EbookFoundation:main
Choose a base branch
from
davorpa:feature/35
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fba83af
create CI/CD pipeline
davorpa 6374f24
fix(build): resolve react-hooks/exhaustive-deps warnings
davorpa 8dcc599
add lint job to ci/cd pipeline
davorpa 7889624
add .editorconfig
davorpa 0a23c2f
add test job to ci/cd pipeline
davorpa ffa34d8
test: fix transformation in react-markdown module
davorpa 4c37cc2
disable execute `run test:*` but preserve it job
davorpa 63e3097
enable test deploy for pull_requests
davorpa bae6a01
fix: resolve TODO for test job
davorpa d040434
fix: App.js testcases
davorpa 5f24ef9
add more testscases for <App/> component
davorpa 88ccc20
resolve GitHub Actions / lint: warnings
davorpa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
; top-most EditorConfig file | ||
root = true | ||
|
||
; define basic and global for any file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = off | ||
trim_trailing_whitespace = true | ||
curly_bracket_next_line = false | ||
spaces_around_operators = true | ||
|
||
; DOS/Windows batch scripts - | ||
[*.{bat,cmd}] | ||
end_of_line = crlf | ||
|
||
; JavaScript files - | ||
[*.{js,ts}] | ||
curly_bracket_next_line = true | ||
indent_size = 2 | ||
quote_type = double | ||
|
||
; JSON files (normal and commented version) - | ||
[*.{json,jsonc}] | ||
indent_size = 2 | ||
quote_type = double | ||
|
||
; Make - match it own default syntax | ||
[Makefile] | ||
indent_style = tab | ||
|
||
; Markdown files - preserve trail spaces that means break line | ||
[*.{md,markdown}] | ||
trim_trailing_whitespace = false | ||
|
||
; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter | ||
[*.{ps1,psd1,psm1}] | ||
charset = utf-8-bom | ||
end_of_line = crlf | ||
|
||
; YML config files - match it own default syntax | ||
[*.{yaml,yml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
node_modules/ | ||
fpb.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
name: "CI-CD: free-programming-books-search" | ||
|
||
on: # This pipeline is executed when: | ||
push: # - A push event is fired | ||
branches: # over this branches | ||
- main | ||
pull_request: # - A pull request | ||
branches: # over this base branches | ||
- main | ||
types: # is... | ||
- opened # submitted | ||
- synchronize # or push more commits | ||
- reopened # or reopened after closed (no merged) | ||
|
||
permissions: | ||
# needed to checkouts/branching | ||
contents: read | ||
|
||
# This allows a subsequently queued workflow run to interrupt/wait for previous runs | ||
concurrency: | ||
group: '${{ github.workflow }}' | ||
cancel-in-progress: true # true: interrupt, false = wait for | ||
|
||
jobs: | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Run code linter | ||
run: | | ||
npm run lint | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Run webapp builder | ||
run: | | ||
npm run build | ||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
path: build | ||
|
||
# Testcases with Jest | ||
test: | ||
needs: [lint, build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
path: build | ||
- name: Run tests | ||
run: npm test | ||
|
||
|
||
# Tests E2E with Cypress | ||
e2e: | ||
needs: [lint, build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
path: build | ||
- name: Run E2E tests | ||
# TODO: Enable again after configure Cypress test environment | ||
if: ${{ false }} | ||
run: npm run test:e2e | ||
|
||
deploy: | ||
needs: [test, e2e] | ||
permissions: | ||
# needs branching/commit contents | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
path: build | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
token: ${{ github.token }} | ||
# The branch the action should deploy. | ||
branch: gh-pages | ||
# The folder the action should deploy. | ||
folder: build | ||
# Test git push mode?? | ||
dry-run: ${{ github.event_name == 'pull_request' }} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use GitHub deploy pages action here.