diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c938f11..e4512c4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,24 +9,30 @@ jobs: publish: name: publish - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: latest cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - - run: npm run build - - name: Create .npmrc run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - if: contains(github.ref, '-beta') run: npm publish --access public --tag beta - - if: "!contains(github.ref, '-beta')" run: npm publish --access public diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b26b706..01e7809 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,52 +10,94 @@ jobs: lint: name: Lint code - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: latest cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - run: npm run lint test-ubuntu: name: Ubuntu test needs: lint - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: latest cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - run: xvfb-run --server-args="-screen 0 1024x768x24" npm run test:coverage - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} test-macos: name: macOS test needs: lint - runs-on: [macOS-latest] + runs-on: macos-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: latest cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - run: npm run test test-windows: name: Windows test needs: lint - runs-on: [windows-latest] + runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: latest cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: pwsh + run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT} + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - run: npm run test