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 beb3602
Showing 1 changed file with 81 additions and 10 deletions.
91 changes: 81 additions & 10 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,29 @@ jobs:
uses: actions/setup-node@v4
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_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 install
- name: Export the matrix for testing
id: deploy-matrix
run: pnpm exec nx run @infra/azure-functions:github-actions
Expand All @@ -61,11 +78,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 +139,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 +199,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 +228,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 +249,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 beb3602

Please sign in to comment.