mirror of
https://github.com/dependabot/fetch-metadata.git
synced 2026-03-12 18:07:12 -04:00
Use a separate workflow to check the diff compilation
This commit is contained in:
35
.github/workflows/check-dist.yml
vendored
Normal file
35
.github/workflows/check-dist.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Check dist
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'releases/*'
|
||||
|
||||
jobs:
|
||||
verify-build: # make sure the checked in dist/ folder matches the output of a rebuild
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: nvm
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ steps.nvm.outputs.NVMRC }}
|
||||
|
||||
- name: Install NPM dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Rebuild the dist/ directory
|
||||
run: npm run build
|
||||
|
||||
- name: Compare the expected and actual dist/ directories
|
||||
run: script/check-diff
|
||||
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@@ -13,15 +13,20 @@ jobs:
|
||||
name: CI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup nodejs
|
||||
uses: actions/setup-node@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Read .nvmrc
|
||||
id: nvm
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ steps.nvm.outputs.NVMRC }}
|
||||
|
||||
- name: Install NPM dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run linter
|
||||
@@ -29,6 +34,3 @@ jobs:
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
|
||||
- name: Verify the build artefact is updated
|
||||
run: npm run build && git diff --quiet
|
||||
|
||||
11
bin/check-diff
Executable file
11
bin/check-diff
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Make sure we notice any untracked files generated by the build
|
||||
git add --intent-to-add .
|
||||
git diff --quiet dist/
|
||||
retVal=$?
|
||||
if [ $retVal -ne 0 ]; then
|
||||
echo "Detected uncommitted changes after build:"
|
||||
git --no-pager diff dist/
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user