Skip to content

Commit

Permalink
Check duplicate dependencies in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kouak committed Feb 7, 2024
1 parent f66b766 commit ebc3a7d
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:
B2B_XSD_REMOTE_URL: https://wsdl.b2B-proxy.4me.im/26.0.0.tar.gz
B2B_API_KEY_ID: ${{ secrets.B2B_API_KEY_ID }}
B2B_API_SECRET_KEY: ${{ secrets.B2B_API_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# REAL_B2B_CONNECTIONS: true

on:
Expand All @@ -20,6 +21,39 @@ on:
- '*'

jobs:
dedupe-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: 'Install pnpm'
uses: pnpm/action-setup@v2
with:
version: latest

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Check duplicate dependencies
run: pnpm dedupe --check

# Test the lib, runs on every commit
test:
runs-on: ubuntu-latest
Expand All @@ -35,15 +69,15 @@ jobs:
- 20

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: 'Install pnpm'
uses: pnpm/action-setup@v2
with:
version: latest

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -54,7 +88,7 @@ jobs:
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand All @@ -65,7 +99,7 @@ jobs:
run: mkdir b2b-xsd && touch b2b-xsd/.ghcache

- name: '[GH Cache] B2B XSD'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: 'b2b-xsd'
key: ${{ runner.os }}-b2b-xsd-${{ hashFiles('**/b2b-xsd/**')}}
Expand All @@ -88,7 +122,7 @@ jobs:
run: pnpm test:ci

- name: 'Upload coverage'
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: env.REAL_B2B_CONNECTIONS == '1'
with:
fail_ci_if_error: true
Expand All @@ -98,17 +132,19 @@ jobs:
deploy-packages:
if: github.repository == 'DGAC/nmb2b-client-js' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: test
needs:
- test
- dedupe-check
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: 'Install pnpm'
uses: pnpm/action-setup@v2
with:
version: latest

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
Expand All @@ -120,7 +156,7 @@ jobs:
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down

0 comments on commit ebc3a7d

Please sign in to comment.