Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve workflows and package configuration #142

Merged
merged 8 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[*]
charset = utf-8
end_of_line = crlf
end_of_line = lf
insert_final_newline = true
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ master, next ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ master, next ]
schedule:
- cron: '18 20 * * 2'

jobs:
analyze:
name: Analyze
runs-on: windows-latest
runs-on: ubuntu-latest

permissions:
actions: read
Expand Down
42 changes: 15 additions & 27 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ on: [ pull_request ]
jobs:
static-analysis:
name: Static analysis
runs-on: windows-latest

strategy:
matrix:
node-version: [ 18.x ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc file
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm run ci -- --ignore-scripts
- name: Run ESLint
Expand All @@ -26,18 +22,14 @@ jobs:

unit:
name: Unit tests
runs-on: windows-latest

strategy:
matrix:
node-version: [ 18.x ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc file
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version-file: ".nvmrc"
- name: Use latest stable Chrome
uses: browser-actions/setup-chrome@latest
with:
Expand All @@ -51,16 +43,12 @@ jobs:
name: Visual tests
runs-on: windows-latest

strategy:
matrix:
node-version: [ 18.x ]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc file
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version-file: ".nvmrc"
- name: Use latest stable Chrome
uses: browser-actions/setup-chrome@latest
with:
Expand All @@ -73,7 +61,7 @@ jobs:
run: npm run test:visual:ci
- name: Save visual regression tests artifacts (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: .loki
path: .loki/
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish to npm

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc file
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Use latest stable Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Install dependencies
run: npm run ci
- name: Run ESLint
run: npm run lint
- name: Run unit tests
run: npm run test:unit:ci
- name: Run visual regression tests
run: npm run test:visual:ci
- name: Save visual regression tests artifacts (on failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: .loki
path: .loki/
retention-days: 5
- name: Publish (@latest)
run: npm publish --access public
if: ${{!github.event.release.prerelease}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
- name: Publish (@next)
run: npm publish --access public --tag next
if: ${{github.event.release.prerelease}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
!/dist/**
!/es/**
!/types/**
!/src/**
!package.json
!.npmignore
!README.md
!LICENSE.md
!CHANGELOG.md
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
endOfLine: 'crlf',
endOfLine: 'lf',
printWidth: 120,
semi: true,
singleQuote: true,
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,12 @@ Visual regression tests use the built version of SDK, so before running them mak
last change you made. You can this using the `npm run build` command or using the `npm run dev` command to start build
in a watch mode.

Please note that the reference screenshots for visual regression tests are created on the `windows-latest` environment,
which is utilized in our GitHub Action workflow for visual tests. It means tests could (and probably will) fail on
another OS. In case the visual regression tests fail during a pull request, and you need to update reference screenshots,
you can locate the new screenshots in the failed GitHub Action run. Navigate to the Artifacts section (`.loki/current`)
of the failed run to find the updated screenshots.

## Breaking changes

All breaking changes can be found in [a separate markdown file](BREAKING.md).
Expand Down
Loading