Fix build cache (#1996)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-06-03 23:44:11 +07:00
committed by GitHub
parent 49572cc712
commit 09cc70dfd6
106 changed files with 2685 additions and 3205 deletions
+48 -71
View File
@@ -2,13 +2,17 @@
name: CI
# Controls when the action will run.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, develop ]
branches: [main, develop]
pull_request:
branches: [ main, develop ]
branches: [main, develop]
create:
tags:
- v*
@@ -25,6 +29,9 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v3
env:
@@ -34,8 +41,27 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Cache PR common
uses: actions/cache@v3
with:
path: ./common/temp
key: ${{ runner.os }}-build-ref-${{ github.ref }}
restore-keys: |
${{ runner.os }}-build-ref-${{ github.ref }}
- name: Cache build results
- name: Checking for mis-matching dependencies...
run: node common/scripts/install-run-rush.js check
- name: Installing...
run: node common/scripts/install-run-rush.js install
- name: Setting model version from git release...
run: node common/scripts/install-run-rush.js bump-model-version
- name: Building...
run: node common/scripts/install-run-rush.js build
- name: Cache build results for next jobs
uses: actions/cache@v3
env:
cache-name: cache-build-results
@@ -56,24 +82,8 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
# Checkout after restore cache
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checking for mis-matching dependencies...
run: node common/scripts/install-run-rush.js check
- name: Installing...
run: node common/scripts/install-run-rush.js install
- name: Setting model version from git release...
run: node common/scripts/install-run-rush.js bump-model-version
- name: Building...
run: node common/scripts/install-run-rush.js build -p 16 -l
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
svelte-check:
needs: build
runs-on: ubuntu-latest
@@ -103,45 +113,11 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Checking svelte sources...
run: node common/scripts/install-run-rush.js svelte-check
linting:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache build results
uses: actions/cache@v3
env:
cache-name: cache-build-results
with:
path: |
cloud
common
deploy
dev
models
packages
plugins
pods
products
server
server-plugins
templates
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
- name: Linting...
run: node common/scripts/install-run-rush.js lint -p 16
formatting:
needs: build
runs-on: ubuntu-latest
@@ -149,7 +125,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache build results
uses: actions/cache@v3
env:
@@ -171,11 +146,13 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Install...
run: node common/scripts/install-run-rush.js install
- name: Formatting...
run: node common/scripts/install-run-rush.js format -p 16
run: node common/scripts/install-run-rush.js format
- name: Check files formatting
run: |
echo '================================================================'
@@ -183,7 +160,7 @@ jobs:
echo '================================================================'
git diff '*.ts' '*.svelte' | cat
[ -z "$(git diff --name-only '*.ts' '*.svelte' | cat)" ]
echo '================================================================'
echo '================================================================'
test:
needs: build
runs-on: ubuntu-latest
@@ -213,8 +190,8 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
@@ -259,8 +236,8 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Installing...
run: node common/scripts/install-run-rush.js install
@@ -288,7 +265,7 @@ jobs:
path: ./tests/sanity/playwright-report/
docker-build:
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [ build, uitest, test, linting, svelte-check ]
needs: [build, uitest, test, svelte-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -316,15 +293,15 @@ jobs:
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Installing...
run: node common/scripts/install-run-rush.js install
- name: Setting model version from git release...
run: node common/scripts/install-run-rush.js bump-model-version
- name: Build, to include new model version
run: node common/scripts/install-run-rush.js build -p 16
run: node common/scripts/install-run-rush.js build
- name: Bundle
run: node common/scripts/install-run-rush.js bundle
- name: Docker build