0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

chore: reuse workflows configurations (#4965)

* build

test

test

test

Update action.yml

Update action.yml

test

test

Update action.yml

Update action.yml

Update action.yml

test

test

Update ci.yml

Update ci.yml

test

test

test

test

Update action.yml

test

Update ci.yml

Update e2e-ci.yml

test

* Update ci.yml

* Update plugin-generator-e2e.yaml

* test

* test

* test

* test

* Update e2e-ci.yml

* Update e2e-ui.yml

* test

* Update ci.yml

* Update ci.yml

* Update action.yml

* Update action.yml

* Update package.json

* Update static-data.yml

* Update static-data.yml

* Update website.yml

* test

* Update ui-components.yml

* Update ui-components.yml

* Update ui-components.yml
This commit is contained in:
Juan Picado 2024-11-28 10:53:05 +01:00 committed by GitHub
parent ac1056025d
commit 47e6ce9083
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 212 additions and 283 deletions

22
.github/actions/build-app/action.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: 'Build app'
description: 'build verdaccio application'
inputs:
registry-url:
description: 'Registry URL for pnpm'
required: false
default: 'http://localhost:4873'
node-version:
description: 'Node.js version to use'
required: true
runs:
using: composite
steps:
- name: Install dependencies with a custom registry version ${{ inputs.node-version }}
uses: ./.github/actions/install-app-node
with:
node-version: ${{ inputs.node_version }}
- name: build
run: pnpm build
shell: bash

View file

@ -0,0 +1,12 @@
name: 'Cache packages'
description: 'get or set cache packages'
runs:
using: composite
steps:
- name: Cache Packages
id: cache-packages
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}

15
.github/actions/cache-store/action.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: 'Cache build'
description: 'get or set cache build'
runs:
using: composite
steps:
- name: Cache .pnpm-store
id: cache-npm
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.event.pull_request.number }}-${{ runner.os }}
restore-keys: |
pnpm-

View file

@ -0,0 +1,50 @@
name: 'Install app with Node specific version'
description: 'install application'
inputs:
registry-url:
description: 'Registry URL for pnpm'
required: false
default: 'http://localhost:4873'
reporter:
description: 'Reporter for pnpm'
required: false
default: 'silent'
loglevel:
description: 'Log level for pnpm'
required: false
default: 'error'
node-version:
description: 'Node.js version to use'
required: true
runs:
using: composite
steps:
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ inputs.node-version }}
- name: Install pnpm
run: |
corepack enable
corepack prepare
shell: bash
- name: set store
run: |
if [ ! -d "$HOME/.pnpm-store" ]; then
mkdir -p $HOME/.pnpm-store
pnpm config set store-dir $HOME/.pnpm-store
else
echo "Store directory already exists. Skipping configuration."
fi
shell: bash
- name: Restore cache pnpm store
uses: ./.github/actions/cache-store
- name: Install
run: pnpm install --reporter=${{inputs.reporter}} --ignore-scripts --registry ${{ inputs.registry-url }} --loglevel=${{ inputs.loglevel }}
shell: bash
- name: Save cache pnpm store
if: steps.cache-npm.outputs.cache-hit == 'false'
uses: ./.github/actions/cache-store

39
.github/actions/install-app/action.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: 'Install app'
description: 'install application'
inputs:
registry-url:
description: 'Registry URL for pnpm'
required: false
default: 'http://localhost:4873'
reporter:
description: 'Reporter for pnpm'
required: false
default: 'silent'
runs:
using: composite
steps:
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack prepare
shell: bash
- name: set store
run: |
mkdir ~/.pnpm-store
pnpm config set store-dir ~/.pnpm-store
shell: bash
- name: Restore cache pnpm store
uses: ./.github/actions/cache-store
- name: Install
run: pnpm install --reporter=${{inputs.reporter}} --ignore-scripts --registry ${{ inputs.registry-url }}
shell: bash
- name: Save cache pnpm store
if: steps.cache-npm.outputs.cache-hit == 'false'
uses: ./.github/actions/cache-store

View file

@ -29,52 +29,25 @@ jobs:
- 4873:4873
env:
NODE_ENV: production
options: >-
--health-cmd="curl -f http://0.0.0.0:4873/-/ping || exit 1"
--health-interval=10s
--health-timeout=20s
--health-retries=6
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack install
- name: set store
run: |
mkdir ~/.pnpm-store
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --registry http://localhost:4873
- name: Cache .pnpm-store
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
lint:
runs-on: ubuntu-latest
name: Lint
needs: prepare
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack install
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --ignore-scripts
reporter: 'default'
- name: Lint
run: pnpm lint
format:
@ -83,23 +56,10 @@ jobs:
needs: prepare
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack install
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --ignore-scripts
reporter: 'default'
- name: Lint
run: pnpm format:check
test:
@ -113,25 +73,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node ${{ matrix.node_version }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Build application with Node ${{ matrix.node_version }}
uses: ./.github/actions/build-app
with:
node-version: ${{ matrix.node_version }}
- name: Install pnpm
run: |
corepack enable
corepack prepare
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --ignore-scripts --registry http://localhost:4873
- name: build
run: pnpm build
- name: Test
run: pnpm test
sync-translations:

View file

@ -19,67 +19,19 @@ jobs:
NODE_ENV: production
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack prepare
- name: set store
run: |
mkdir ~/.pnpm-store
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --reporter=silence --ignore-scripts --registry http://localhost:4873
- name: Cache .pnpm-store
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: |
pnpm-
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
build:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Build application with Node ${{ matrix.node_version }}
uses: ./.github/actions/build-app
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack prepare
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm recursive install --reporter=silence --registry http://localhost:4873
- name: build
run: pnpm build
node-version: ${{ matrix.node_version }}
- name: Cache packages
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
id: cache-packages
with:
path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: |
packages-
# - name: Cache test
# uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3
# id: cache-test
# with:
# path: ./e2e/
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
# restore-keys: |
# test-
uses: ./.github/actions/cache-packages
e2e-cli-npm:
needs: [prepare, build]
strategy:
@ -93,37 +45,19 @@ jobs:
npm9,
npm10
]
node: [20, 22]
node: [18, 23]
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry version ${{ inputs.node-version }}
uses: ./.github/actions/install-app-node
with:
node-version: ${{ matrix.node }}
- name: Install pnpm
run: |
corepack enable
corepack prepare
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --offline --reporter=silence --ignore-scripts --registry http://localhost:4873
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
# - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3
# with:
# path: ./e2e/
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: build e2e
run: pnpm --filter @verdaccio/test-cli-commons build
node-version: ${{ inputs.node_version }}
reporter: 'default'
loglevel: 'debug'
- name: Restore cache pnpm store
uses: ./.github/actions/cache-packages
- name: Test CLI
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}
@ -138,37 +72,19 @@ jobs:
pnpm9,
pnpm10,
]
node: [20, 22]
node: [18, 23]
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry version ${{ inputs.node-version }}
uses: ./.github/actions/install-app-node
with:
node-version: ${{ matrix.node }}
- name: Install pnpm
run: |
corepack enable
corepack prepare
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --loglevel debug --ignore-scripts --registry http://localhost:4873
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
# - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3
# with:
# path: ./e2e/
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: build e2e
run: pnpm --filter @verdaccio/test-cli-commons build
node-version: ${{ inputs.node_version }}
reporter: 'default'
loglevel: 'debug'
- name: Restore cache pnpm store
uses: ./.github/actions/cache-packages
- name: Test CLI
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}
e2e-cli-yarn:
@ -183,37 +99,19 @@ jobs:
yarn3,
yarn4
]
node: [20, 22]
node: [18, 23]
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry version ${{ inputs.node-version }}
uses: ./.github/actions/install-app-node
with:
node-version: ${{ matrix.node }}
- name: Install pnpm
run: |
corepack enable
corepack prepare
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: set store
run: |
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --offline --reporter=silence --ignore-scripts --registry http://localhost:4873
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
# - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3
# with:
# path: ./e2e/
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: build e2e
run: pnpm --filter @verdaccio/test-cli-commons build
node-version: ${{ inputs.node_version }}
reporter: 'default'
loglevel: 'debug'
- name: Restore cache pnpm store
uses: ./.github/actions/cache-packages
- name: Test CLI
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}

View file

@ -1,6 +1,7 @@
name: E2E UI
on: [pull_request]
permissions:
contents: read
concurrency:
@ -19,18 +20,10 @@ jobs:
NODE_ENV: production
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Build application with Node 20
uses: ./.github/actions/build-app
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack prepare
- name: Install
run: pnpm install --reporter=silence --registry http://localhost:4873
- name: build
run: pnpm build
node-version: 20
- name: Test UI
run: pnpm test:e2e:ui
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3

View file

@ -16,25 +16,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18,20, 21]
node-version: [20, 22, 23]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Build application with Node ${{ matrix.node_version }}
uses: ./.github/actions/build-app
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
run: |
corepack enable
corepack install
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: install
run: pnpm install
- name: build
run: pnpm build
node-version: ${{ matrix.node_version }}
- name: install verdaccio
run: npm install -g verdaccio@5
- name: Start server

View file

@ -3,6 +3,7 @@ name: static data
on:
workflow_dispatch:
# pull_request:
schedule:
# twice peer week
- cron: '0 0 * * 1,4'
@ -24,13 +25,10 @@ jobs:
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
with:
node-version: 18.x
- name: install pnpm
run: sudo npm i pnpm@latest-8 -g
- name: install dependencies
run: pnpm install
reporter: 'default'
- name: Build Translations percentage
run: pnpm --filter @verdaccio/crowdin-translations build
- name: update contributors

View file

@ -1,9 +1,10 @@
name: UI Components
on:
# pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
# schedule:
# - cron: '0 0 * * *'
permissions:
contents: read # to fetch code (actions/checkout)
@ -25,25 +26,13 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
- name: Cache pnpm modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Install dependencies with a custom registry
uses: ./.github/actions/install-app
- name: Install pnpm
run: |
corepack enable
corepack prepare --activate pnpm@8.9.0
corepack prepare
- name: Install
run: pnpm install
- name: Build storybook

View file

@ -2,7 +2,6 @@ name: Verdaccio Website CI
on:
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
@ -31,30 +30,10 @@ jobs:
NODE_OPTIONS: --max_old_space_size=4096
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Build application with Node 20
uses: ./.github/actions/build-app
with:
node-version-file: '.nvmrc'
- name: Install pnpm
run: |
corepack enable
corepack install
- name: set store
run: |
mkdir ~/.pnpm-store
pnpm config set store-dir ~/.pnpm-store
- name: Install
run: pnpm install --registry http://localhost:4873
- name: Cache .pnpm-store
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-
- name: Build
run: pnpm build
node-version: 20
- name: Build Translations percentage
run: pnpm --filter @verdaccio/crowdin-translations build
- name: Cache Docusaurus Build

View file

@ -13,6 +13,7 @@
},
"scripts": {
"cypress:open": "cypress open",
"test": "cypress run"
"cypress:install": "cypress install",
"test": "cypress install && cypress run"
}
}