Buffer from body #740
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
name: continuous-integration | |
on: | |
pull_request_target: | |
push: | |
branches: | |
- develop | |
- feature/** | |
env: | |
CI: true | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
FONTAWESOME_TOKEN: ${{ secrets.FONTAWESOME_TOKEN }} | |
jobs: | |
prepare: | |
runs-on: ubuntu-20.04 | |
name: Prepare | |
steps: | |
- | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
- | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- | |
name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
${{ runner.os }}- | |
- | |
name: Install dependencies | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: | | |
yarn install --frozen-lockfile | |
check: | |
runs-on: ubuntu-20.04 | |
needs: prepare | |
name: Check | |
steps: | |
- | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
- | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- | |
name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
${{ runner.os }}- | |
- | |
name: Install dependencies | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: | | |
yarn install --frozen-lockfile | |
- | |
name: Lint | |
run: | | |
yarn lint | |
build-and-run: | |
runs-on: ubuntu-20.04 | |
needs: prepare | |
name: Build | |
steps: | |
- | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Checkout code | |
uses: actions/[email protected] | |
- | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- | |
name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
${{ runner.os }}- | |
- | |
name: Cache next | |
id: cache-next | |
uses: actions/[email protected] | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }} | |
- | |
name: Install dependencies | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: | | |
yarn install --frozen-lockfile | |
- | |
name: Build | |
run: | | |
yarn build | |
- | |
name: Run & check status code | |
run: | | |
node .next/standalone/server.js & | |
PID=$! | |
sleep 5 | |
curl --silent --fail http://localhost:3000/api/_health | |
kill -s SIGINT $PID |