diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 00000000..d5bc933f --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,40 @@ +name: 'Setup Node.js and pnpm' +description: 'Sets up Node.js and pnpm with caching' + +inputs: + node-version: + description: 'Node.js version to use' + required: false + default: '22.x' + +runs: + using: 'composite' + steps: + - name: Use Node.js ${{ inputs.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + + - name: Setup pnpm + uses: pnpm/action-setup@v4.1.0 + with: + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Cache pnpm modules + uses: actions/cache@v4 + env: + cache-name: cache-pnpm-modules + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Install Dependencies + shell: bash + run: pnpm i diff --git a/.github/workflows/api-client.yml b/.github/workflows/api-client.yml index fcff85ba..8719ed0b 100644 --- a/.github/workflows/api-client.yml +++ b/.github/workflows/api-client.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: - node-version: [20.x] + node-version: [22.x] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a9bd6c6..a07e3e77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,8 @@ on: - 'v*' paths-ignore: - CHANGELOG.MD - branches: master + branches: + - master pull_request: workflow_dispatch: name: CI @@ -54,44 +55,15 @@ jobs: core: name: Build (Core) runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node with: - node-version: ${{ matrix.node-version }} - - - name: Setup pnpm - uses: pnpm/action-setup@v4.1.0 - with: - version: - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Cache pnpm modules - uses: actions/cache@v4 - env: - cache-name: cache-pnpm-modules - with: - path: ${{ env.STORE_PATH }} - 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 }}-${{ hashFiles('**/pnpm-lock.yaml') }} - - name: Install Dependencies - run: | - pnpm i + node-version: '22.x' - name: Build project - run: | - npm run bundle + run: npm run bundle - name: Start MongoDB uses: supercharge/mongodb-github-action@1.12.0 with: @@ -101,36 +73,22 @@ jobs: with: redis-version: 6 - name: Test Bundle Server - run: | - bash scripts/workflow/test-server.sh + run: bash scripts/workflow/test-server.sh + test: name: Test timeout-minutes: 10 runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node with: - node-version: ${{ matrix.node-version }} - - - name: Setup pnpm - uses: pnpm/action-setup@v3 - with: - run_install: | - - recursive: false + node-version: '22.x' - name: Run Lint - run: | - npm run lint - + run: npm run lint - name: Run Tests - run: | - npm run test - + run: npm run test env: CI: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32916bfd..7350134d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version: 22.x - name: Start MongoDB uses: supercharge/mongodb-github-action@1.12.0 @@ -32,7 +32,6 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 with: - version: run_install: false - name: Get pnpm store directory