Skip to content

Commit

Permalink
Merge pull request #5 from nora-codecov/part4
Browse files Browse the repository at this point in the history
part 4
  • Loading branch information
nora-codecov authored Sep 13, 2024
2 parents 9ff749f + 386e699 commit b8152ca
Show file tree
Hide file tree
Showing 13 changed files with 6,649 additions and 17 deletions.
19 changes: 17 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@ jobs:
- run:
name: Run tests and collect coverage
command: pytest --cov api.calculator
- codecov/upload
- codecov/upload:
flags: backend
test-frontend:
docker:
- image: cimg/node:17.6.0
steps:
- checkout
- run:
name: Install requirements
command: cd web && npm install
- run:
name: Run tests and collect coverage
command: cd web && npm run test
- codecov/upload:
flags: frontend

workflows:
version: 2.1
build-test:
jobs:
- test-api
- test-api
- test-frontend
1 change: 1 addition & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ jobs:
uses: codecov/[email protected]
with:
use_oidc: true
flags: backend
29 changes: 29 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Frontend workflow

on: [push, pull_request]

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
build:
runs-on: ubuntu-latest
name: Test JS frontend
defaults:
run:
working-directory: ./web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install requirements
run: npm install
- name: Run tests and collect coverage
run: npm run test
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/[email protected]
with:
use_oidc: true
flags: frontend
31 changes: 16 additions & 15 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
coverage:
status:
project:
default:
target: 100%
threshold: 1%
project: off
patch: off

comment:
layout: "condensed_header, diff, flags, components"

component_management:
individual_components:
- component_id: api-calculator # this is an identifier that should not be changed
name: calculator # this is a display name, and can be changed freely
flag_management:
individual_flags:
- name: backend
paths:
- api/calculator/
- component_id: api-smiles # this is an identifier that should not be changed
name: smiles # this is a display name, and can be changed freely
- api/
statuses:
- type: project
target: 100%
threshold: 1%
- name: frontend
paths:
- api/smiles/
- web/
statuses:
- type: project
target: auto
threshold: 1%
7 changes: 7 additions & 0 deletions web/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"env": {
"test": {
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
}
}
36 changes: 36 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Codecov Server-side Calculator App</title>
<link rel="stylesheet" href="/static/css/calculator.css">
</head>
<body>
<div class="calculator">
<div class="output">
<div data-previous-operand class="previous-operand">123 +</div>
<div data-current-operand class="current-operand">456</div>
</div>
<button class="span-3 disabled"></button>
<button data-all-clear>C</button>
<button data-number>7</button>
<button data-number>8</button>
<button data-number>9</button>
<button data-operation>÷</button>
<button data-number>4</button>
<button data-number>5</button>
<button data-number>6</button>
<button data-operation>*</button>
<button data-number>1</button>
<button data-number>2</button>
<button data-number>3</button>
<button data-operation>-</button>
<button data-number>.</button>
<button data-number>0</button>
<button data-equals>=</button>
<button data-operation>+</button>
</div>
<script type="module" src="/static/js/calculatorView.js"></script>
</body>
</html>
Loading

0 comments on commit b8152ca

Please sign in to comment.