Skip to content

Commit

Permalink
feat(github-actions): add pnpm & npm cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 17, 2024
1 parent c0c42ae commit 6b9a870
Showing 1 changed file with 62 additions and 8 deletions.
70 changes: 62 additions & 8 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,27 @@ jobs:
with:
node-version: ${{ matrix.version }}

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: ${{ env.pnpm_version }}
- run: pnpm install
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm build

Expand Down Expand Up @@ -106,11 +122,33 @@ jobs:
with:
node-version: ${{ matrix.version }}

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: ${{ env.pnpm_version }}
- run: pnpm install
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- uses: actions/cache@v4
name: Setup npm global cache
with:
path: ~/.npm
key: ${{ runner.os }}-build-azure-functions-core-tools-v4

- name: Install Azure Functions Core Tools
run: npm i -g azure-functions-core-tools@4 --unsafe-perm true
Expand Down Expand Up @@ -144,7 +182,7 @@ jobs:

deploy:
# Only run this job on push events
if: github.event_name == 'push'
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- build
Expand Down Expand Up @@ -173,7 +211,7 @@ jobs:

e2e-azure:
# Only run this job on push events
if: github.event_name == 'push'
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- build
Expand All @@ -194,11 +232,27 @@ jobs:
with:
node-version: ${{ env.node_version }}

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: ${{ env.pnpm_version }}
- run: pnpm install
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run E2E tests
run: pnpm exec nx run @infra/azure-functions:test:e2e-remote
Expand Down

0 comments on commit 6b9a870

Please sign in to comment.