1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00
portfolio/.github/workflows/ci.yml

91 lines
2.0 KiB
YAML
Raw Normal View History

2019-11-26 01:05:58 +01:00
name: 'CI/CD Pipeline'
2019-11-13 18:43:58 +01:00
2019-12-07 15:16:07 +01:00
on:
push:
branches:
2021-01-30 19:20:15 +01:00
- main
2019-12-07 15:16:07 +01:00
pull_request:
branches:
- '**'
2019-11-13 18:43:58 +01:00
2023-09-09 17:13:10 +02:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_PUBLIC_TYPEKIT_ID: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }}
NEXT_PUBLIC_UMAMI_SCRIPT_URL: ${{ secrets.NEXT_PUBLIC_UMAMI_SCRIPT_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
2019-11-13 18:43:58 +01:00
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run prebuild
- run: npm run lint
- run: npm run typecheck
2019-11-14 01:22:14 +01:00
test:
2019-11-13 18:43:58 +01:00
runs-on: ubuntu-latest
2019-11-26 01:05:58 +01:00
steps:
2024-02-06 00:44:15 +01:00
- uses: actions/checkout@v4
2019-11-26 01:05:58 +01:00
2019-11-26 01:20:37 +01:00
- name: Setup Node.js
2024-02-06 00:44:15 +01:00
uses: actions/setup-node@v4
2019-11-26 01:05:58 +01:00
with:
2024-02-06 00:04:49 +01:00
node-version: 20
2023-09-09 17:13:10 +02:00
cache: 'npm'
2019-11-26 01:05:58 +01:00
- run: npm ci
- run: npm run prebuild
2021-02-06 13:45:47 +01:00
- run: npm test
2019-11-26 02:18:54 +01:00
2024-02-06 00:44:15 +01:00
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/
coverage:
runs-on: ubuntu-latest
needs: [test]
if: ${{ success() && github.actor != 'dependabot[bot]' }}
steps:
2024-02-06 00:44:15 +01:00
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage
2024-02-06 00:44:15 +01:00
- uses: paambaati/codeclimate-action@v5.0.0
2019-11-26 02:18:54 +01:00
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
2019-11-26 01:05:58 +01:00
build:
runs-on: ubuntu-latest
2019-11-13 18:43:58 +01:00
steps:
2024-02-06 00:44:15 +01:00
- uses: actions/checkout@v4
2019-11-18 23:02:57 +01:00
2019-11-26 01:20:37 +01:00
- name: Setup Node.js
2024-02-06 00:44:15 +01:00
uses: actions/setup-node@v4
2019-11-13 18:53:31 +01:00
with:
2024-02-06 00:04:49 +01:00
node-version: 20
2023-09-09 17:13:10 +02:00
cache: 'npm'
2019-11-13 18:53:31 +01:00
2023-09-09 17:13:10 +02:00
- name: Cache Next.js build output
2024-02-06 00:44:15 +01:00
uses: actions/cache@v4
2019-11-13 18:53:31 +01:00
with:
2023-09-09 17:13:10 +02:00
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
2019-11-13 18:53:31 +01:00
2019-11-18 23:02:57 +01:00
- run: npm ci
- run: npm run build