chore: add cache in pipelines #140
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: Prettier-java | |
on: [push, pull_request] | |
jobs: | |
tests: | |
name: unit tests (node ${{ matrix.node_version }}) | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')" | |
strategy: | |
matrix: | |
node_version: | |
- 18.x | |
- 20.x | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache java-parser cloned repository | |
id: java-parser-cache-cloned-repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/java-parser/samples | |
key: ${{ runner.os }}-java-parser-cache-cloned-repository | |
- name: Cache Prettier Plugin Java cloned repository | |
id: prettier-plugin-java-cache-cloned-repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/prettier-plugin-java/samples | |
packages/prettier-plugin-java/test-samples | |
key: ${{ runner.os }}-prettier-plugin-java-cache-cloned-repository | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
cache: 'yarn' | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17.x | |
distribution: zulu | |
- name: Install dependencies | |
run: yarn | |
- name: Run CI | |
run: yarn run ci | |
e2e-tests: | |
name: ${{ matrix.test_repository }} (node ${{ matrix.node_version }}) | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')" | |
strategy: | |
matrix: | |
test_repository: | |
- e2e-jhipster1 | |
- e2e-jhipster2 | |
node_version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache java-parser cloned repository | |
id: java-parser-cache-cloned-repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/java-parser/samples | |
key: ${{ runner.os }}-java-parser-cache-cloned-repository | |
- name: Cache Prettier Plugin Java cloned repository | |
id: prettier-plugin-java-cache-cloned-repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/prettier-plugin-java/samples | |
packages/prettier-plugin-java/test-samples | |
key: ${{ runner.os }}-prettier-plugin-java-cache-cloned-repository | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
cache: 'yarn' | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17.x | |
distribution: zulu | |
- name: Install dependencies | |
run: yarn | |
- name: Build prettier-plugin-java | |
run: yarn run build:prettier-plugin-java | |
- name: Run e2e tests | |
run: yarn run test:prettier-plugin-java test:${{ matrix.test_repository }} |