Adding caching for maven and yarn (#9788)

Co-authored-by: Dhruvin Maniar <dhruvinmaniar@Dhruvins-MacBook-Pro.local>
This commit is contained in:
dhruvinmaniar123 2023-01-31 01:16:52 +05:30 committed by GitHub
parent d464a8a255
commit 406ea35845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 0 deletions

View File

@ -65,7 +65,31 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache Maven Dependencies
id: cache-output
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Get yarn cache directory path
if: steps.cache-output.outputs.exit-code == 0
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: steps.yarn-cache-dir-path.outputs.exit-code == 0
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'

View File

@ -65,7 +65,31 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache Maven Dependencies
id: cache-output
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Get yarn cache directory path
if: steps.cache-output.outputs.exit-code == 0
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: steps.yarn-cache-dir-path.outputs.exit-code == 0
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'

View File

@ -66,13 +66,24 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache Maven dependencies
id: cache-output
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Install Ubuntu dependencies
if: steps.cache-output.outputs.exit-code == 0
run: |
sudo apt-get update
sudo apt-get install -y unixodbc-dev python3-venv librdkafka-dev gcc libsasl2-dev build-essential libssl-dev libffi-dev \

View File

@ -54,14 +54,45 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Caching NPM dependencies
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Caching NPM dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js ${{ matrix.node-version }}
if: steps.npm-cache.outputs.exit-code == 0
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Antlr4 CLI
run: |
sudo make install_antlr_cli
- name: Install Yarn Packages
if: steps.yarn-cache.outputs.exit-code == 0
working-directory: ${{ env.UI_WORKING_DIRECTORY }}
run: yarn install
- name: Run Coverage