diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a5ef34df..250ba013e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,18 +11,8 @@ jobs: with: node-version: 16 registry-url: https://registry.npmjs.org/ - - name: Get NodeJS Version - id: nodeversion - run: | - echo "::set-output name=version::$(node --version)" - - name: Restore node_modules cache - id: cache-node-modules - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-${{ steps.nodeversion.outputs.version }}-${{ hashFiles('npm-shrinkwrap.json') }} + cache: 'npm' - name: Install dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci - name: Build run: npm run build @@ -83,30 +73,32 @@ jobs: -u ${{ secrets.HASSIO_TRIGGER_SECRET }} \ "https://dev.azure.com/zigbee2mqtt/Zigbee2mqtt%20Add-on/_apis/build/builds?api-version=5.1" - tests: + tests: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node: [14, 16, 17] + node: [14, 16, 17, 18] exclude: - os: windows-latest # https://github.com/serialport/node-serialport/issues/2344 node: 17 runs-on: ${{ matrix.os }} + continue-on-error: true steps: - uses: actions/checkout@v3 + - name: Cache node-gyp + uses: actions/cache@v3 + with: + key: ${{ matrix.os }}-${{ matrix.node }}-node-gyp + path: | + /home/runner/.cache/node-gyp + C:\Users\runneradmin\AppData\Local\node-gyp + /Users/runner/Library/Caches/node-gyp - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} registry-url: https://registry.npmjs.org/ - - - name: Restore node_modules cache - id: cache-node-modules - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('npm-shrinkwrap.json') }} + cache: 'npm' - name: Install dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci - name: Lint run: npm run eslint diff --git a/.github/workflows/update_deps.yml b/.github/workflows/update_deps.yml index 1b61780a2..489d113aa 100644 --- a/.github/workflows/update_deps.yml +++ b/.github/workflows/update_deps.yml @@ -15,9 +15,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 - - run: rm -rf npm-shrinkwrap.json - run: npx npm-check-updates -u -x connect-gzip-static # connect-gzip-static only supports node 16 - - run: npm install && npm shrinkwrap --dev + - run: npm install - uses: peter-evans/create-pull-request@v4 with: commit-message: Update dependencies diff --git a/docker/Dockerfile b/docker/Dockerfile index 22d307151..75742c7d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,12 +3,10 @@ FROM node:16-alpine3.15 as base WORKDIR /app RUN apk add --no-cache tzdata eudev tini -COPY package.json ./ - # Dependencies and build FROM base as dependencies_and_build -COPY npm-shrinkwrap.json tsconfig.json index.js ./ +COPY package*.json tsconfig.json index.js ./ COPY lib ./lib RUN apk add --no-cache --virtual .buildtools make gcc g++ python3 linux-headers git && \ @@ -20,7 +18,7 @@ FROM base as release COPY --from=dependencies_and_build /app/node_modules ./node_modules COPY dist ./dist -COPY LICENSE index.js data/configuration.yaml ./ +COPY package.json LICENSE index.js data/configuration.yaml ./ COPY docker/docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh diff --git a/npm-shrinkwrap.json b/package-lock.json similarity index 100% rename from npm-shrinkwrap.json rename to package-lock.json diff --git a/update.sh b/update.sh index 1cd10ee6a..f9010c8e5 100755 --- a/update.sh +++ b/update.sh @@ -18,7 +18,6 @@ echo "Creating backup of configuration..." cp -R data data-backup echo "Updating..." -git checkout HEAD -- npm-shrinkwrap.json git pull echo "Installing dependencies..."