Run Bundlemon on release optimized build (#7934)

This commit is contained in:
Jon Koops
2022-01-21 13:11:04 +01:00
committed by GitHub
parent 44e4975339
commit fe034acf48
2 changed files with 87 additions and 22 deletions

View File

@ -10,7 +10,7 @@
"github", "github",
{ {
"checkRun": true, "checkRun": true,
"commitStatus": true, "commitStatus": false,
"prComment": false "prComment": false
} }
] ]

View File

@ -30,43 +30,108 @@ jobs:
if: steps.cache-dependencies.outputs.cache-hit != 'true' if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci run: npm ci
- name: Build project
run: npm run build
env:
NODE_ENV: ${{ startsWith(github.ref, 'refs/tags/v') && 'release' || '' }}
- name: Cache setup - name: Cache setup
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./* path: ./*
key: ${{ runner.os }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}-setup
run: build:
needs: setup needs: setup
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
command: [lint, bundlemon] os: [ubuntu-latest, windows-2019]
steps: steps:
- name: Restore setup - name: Restore setup
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./* path: ./*
key: ${{ runner.os }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}-setup
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: ${{ env.NODE_VERSION }} node-version: ${{ env.NODE_VERSION }}
- name: Run ${{ matrix.command }} task - name: Build project
run: npm run ${{ matrix.command }} run: npm run build
env:
NODE_ENV: ${{ startsWith(github.ref, 'refs/tags/v') && 'release' || '' }}
- name: Cache build
uses: actions/cache@v2
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-build
build-release:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v2
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build project
run: npm run build
env:
NODE_ENV: release
- name: Cache release build
uses: actions/cache@v2
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-build-release
lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v2
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-setup
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Run lint task
run: npm run lint
bundlemon:
needs: build-release
runs-on: ubuntu-latest
steps:
- name: Restore release build
uses: actions/cache@v2
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-build-release
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Run bundlemon task
run: npm run bundlemon
env: env:
BUNDLEMON_PROJECT_ID: 61e0545915f6c3000980d0ed BUNDLEMON_PROJECT_ID: 61e0545915f6c3000980d0ed
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
test: test:
needs: setup needs: build
runs-on: ${{ matrix.os || 'ubuntu-latest' }} runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -80,11 +145,11 @@ jobs:
- browser: IE10 - browser: IE10
os: windows-2019 os: windows-2019
steps: steps:
- name: Restore setup - name: Restore build
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./* path: ./*
key: ${{ runner.os }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}-build
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
@ -95,15 +160,15 @@ jobs:
run: npm test -- --browsers ${{ matrix.browser }} run: npm test -- --browsers ${{ matrix.browser }}
publish-artifacts: publish-artifacts:
needs: setup needs: build
if: github.repository_owner == 'Leaflet' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) if: github.repository_owner == 'Leaflet' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Restore setup - name: Restore build
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./* path: ./*
key: ${{ runner.os }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}-build
- name: Compress artifacts - name: Compress artifacts
working-directory: dist working-directory: dist
@ -127,15 +192,15 @@ jobs:
DEST_DIR: ${{ steps.artifacts-directory.outputs.path }} DEST_DIR: ${{ steps.artifacts-directory.outputs.path }}
publish-npm: publish-npm:
needs: setup needs: build
if: github.repository_owner == 'Leaflet' && startsWith(github.ref, 'refs/tags/v') if: github.repository_owner == 'Leaflet' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Restore setup - name: Restore build
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./* path: ./*
key: ${{ runner.os }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}-build
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2