diff --git a/.github/workflows/ci-package-manager.yml b/.github/workflows/ci-package-manager.yml new file mode 100644 index 0000000..dec49ff --- /dev/null +++ b/.github/workflows/ci-package-manager.yml @@ -0,0 +1,161 @@ +name: ci-package-manager + +# This workflow creates a tarball from repo sources. +# It then checks that each of the following package managers is able to install: +# - npm +# - Yarn v1 Classic +# - Yarn (Modern) +# - pnpm +# - bun + +on: + workflow_call: + +jobs: + build-tarball: + runs-on: ubuntu-latest + + outputs: + version: ${{ steps.get_version.outputs.version }} + + steps: + - name: Check out repo + uses: actions/checkout@v5 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "lts/*" + + - name: Install dependencies + run: npm install + + - name: Build tarball + run: npm pack + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: build + path: eslint-*.tgz + retention-days: 1 + + - name: Get version + id: get_version + run: echo "version=$(jq -r '.version' package.json)" >> "$GITHUB_OUTPUT" + + npm-install: + needs: build-tarball + + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v5 + with: + name: build + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "lts/*" + + - name: npm install + run: | + npm install ./eslint-*-${{ needs.build-tarball.outputs.version }}.tgz -D + + yarn-v1-install: + needs: build-tarball + + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v5 + with: + name: build + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "lts/*" + + - name: yarn add + run: | + yarn add ./eslint-*-${{ needs.build-tarball.outputs.version }}.tgz -D + + yarn-install: + needs: build-tarball + + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v5 + with: + name: build + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "lts/*" + + - name: Install Corepack latest + run: | + npm install -g corepack@latest + corepack enable yarn + + - name: yarn add + run: | + corepack use yarn@latest + yarn init -p + yarn add ./eslint-*-${{ needs.build-tarball.outputs.version }}.tgz -D + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: 0 # Allow installs to modify lockfile + + pnpm-install: + needs: build-tarball + + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v5 + with: + name: build + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: latest + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "lts/*" + + - name: pnpm add + run: | + cat > .npmrc <