Skip to content

Uhtml svelte

Uhtml svelte #541

Workflow file for this run

name: CI
on:
push:
branches: [ $default-branch, master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
setup:
name: Setup environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }}-${{ hashFiles('package.json') }}
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Cache libs
uses: actions/cache@v3
with:
path: packages/*/lib
key: ${{ runner.os }}-lib-${{ github.sha }}
test:
name: Test
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }}-${{ hashFiles('package.json') }}
- name: Load libs from cache
uses: actions/cache@v3
with:
path: packages/*/lib
key: ${{ runner.os }}-lib-${{ github.sha }}
- name: Restore workspaces
run: npm ci
- name: Unit tests
run: npm test -- -- --coverage
- name: Linter
run: npm run lint
- name: Build packages
run: npm run build
- name: Script version check
run: npm run test:es:version
release:
name: Test release
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
preview: ['preact', 'uhtml', 'svelte', 'vanilla']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }}-${{ hashFiles('package.json') }}
- name: Load libs from cache
uses: actions/cache@v3
with:
path: packages/*/lib
key: ${{ runner.os }}-lib-${{ github.sha }}
- name: Restore workspaces
run: npm ci
- name: Test release ${{ matrix.preview }}
run: npm run test:release -- ${{ matrix.preview }}
- name: Archive npm failure logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
retention-days: 1
publish:
if: github.event_name == 'push' && contains(github.ref, '/tags/v')
name: Publish to npm
needs: release
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }}-${{ hashFiles('package.json') }}
- name: Load libs from cache
uses: actions/cache@v3
with:
path: packages/*/lib
key: ${{ runner.os }}-lib-${{ github.sha }}
- name: Restore workspaces
run: npm ci
- name: Create npmrc file
run: echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}" >> $HOME/.npmrc 2> /dev/null
- run: npm run release:publish
- name: Extract tmp current changelog
run: node utils/extractChangelog.js
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: current-changelog.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}