Skip to content

Commit

Permalink
Add type-check job to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoPicolo committed Aug 20, 2022
1 parent 8a3b029 commit 3f3c4d2
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 25 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,35 @@ jobs:
run: yarn install

- name: 🧹 Run lint
run: yarn lint
run: yarn next lint

type-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x

# Cache node modules and next folder
- name: 📬 Caching
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: 🧰 Install dependencies
run: yarn install

- name: 🔧 Check validity of types
run: yarn tsc --noEmit --pretty

test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -103,7 +131,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build:
needs: lint
needs: [lint, type-check]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# testing
/coverage
/reports

# next.js
/.next/
Expand Down
44 changes: 22 additions & 22 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { PHASE_DEVELOPMENT_SERVER, PHASE_TEST } = require('next/constants');
const { PHASE_DEVELOPMENT_SERVER, PHASE_TEST } = require("next/constants")

/** @type {import('next').NextConfig} */
const nextConfig = (phase, { defaultConfig }) => ({
Expand All @@ -7,29 +7,29 @@ const nextConfig = (phase, { defaultConfig }) => ({
swcMinify: true,
compiler: {
...(phase !== PHASE_DEVELOPMENT_SERVER &&
phase !== PHASE_TEST && { removeConsole: true }),
phase !== PHASE_TEST && { removeConsole: true })
},
async redirects() {
return [
{
source: '/',
destination: '/categorias',
permanent: false,
},
];
},
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
});
source: "/",
destination: "/categorias",
permanent: false
}
]
}
// typescript: {
// // !! WARN !!
// // Dangerously allow production builds to successfully complete even if
// // your project has type errors.
// // !! WARN !!
// ignoreBuildErrors: true,
// },
// eslint: {
// // Warning: This allows production builds to successfully complete even if
// // your project has ESLint errors.
// ignoreDuringBuilds: true,
// },
})

module.exports = nextConfig;
module.exports = nextConfig
1 change: 0 additions & 1 deletion reports/eslint-report.json

This file was deleted.

0 comments on commit 3f3c4d2

Please sign in to comment.