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

[AMB-39][AMB-38] feat: ci updates #5

Merged
merged 10 commits into from
Jul 3, 2024
Merged
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
.git
.next
.env
.github
.github
.husky
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global rule:
* @apotdevin @secondl1ght
18 changes: 18 additions & 0 deletions .github/workflows/lighthouse-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lighthouse audit

on: [push]

jobs:
lighthouseci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install && npm install -g @lhci/cli
- run: npm run build
- run: lhci collect
- run: lhci upload
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/lint-build-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Lint and build check

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
lint_build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install modules
run: npm install

- name: Run lint
run: npm run lint

- name: Run build
run: npm run build

docker_build:
if: github.head_ref != 'develop'
needs: lint_build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Docker Buildx Driver
id: docker_driver_setup
uses: docker/setup-buildx-action@v3

- name: Run docker build
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run lint-staged
20 changes: 20 additions & 0 deletions .lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"ci": {
"collect": {
"startServerCommand": "npm run start",
"startServerReadyPattern": "ready on",
"url": ["http://localhost:3000/"],
"numberOfRuns": 1,
"settings": {
"preset": "desktop"
secondl1ght marked this conversation as resolved.
Show resolved Hide resolved
}
},
"assert": {
"preset": "lighthouse:recommended"
},
"upload": {
"target": "temporary-public-storage"
},
"server": {}
}
}
10 changes: 10 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

const buildEslintCommand = filenames =>
`next lint --fix --file ${filenames
.map(f => path.relative(process.cwd(), f))
.join(' --file ')}`;

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
};
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.quickSuggestions": {
"strings": "on"
},
"files.associations": {
"*.css": "tailwindcss"
},
"editor.formatOnSave": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ This is a [Next.js](https://nextjs.org/docs/app/building-your-application/deploy

## Deployed apps

[https://mibanco.app/](https://mibanco.app/)
- [mibanco.app](https://mibanco.app/)
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
Loading
Loading