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

Update dependencies #163

Merged
merged 3 commits into from
Feb 23, 2023
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
109 changes: 109 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI
on: [push, pull_request]
env:
NODE_VERSION: 16
jobs:
setup:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
cache: npm

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Cache setup
uses: actions/cache@v3
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-setup

build:
needs: setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Restore setup
uses: actions/cache@v3
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-setup

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Build project
run: npm run build

- name: Cache build
uses: actions/cache@v3
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-build

lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore setup
uses: actions/cache@v3
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-setup

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Run lint task
run: npm run lint

test:
needs: build
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- browser: Chrome1280x1024
- browser: FirefoxTouch
- browser: FirefoxNoTouch
- browser: Edge
os: windows-latest
steps:
- name: Restore build
uses: actions/cache@v3
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}-build

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Run tests on ${{ matrix.browser }}
run: npm test -- --browsers ${{ matrix.browser }}
55 changes: 38 additions & 17 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Generated on Fri May 30 2014 15:44:45 GMT-0400 (EDT)

module.exports = function (config) {
var configuration = {
const configuration = {

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai-sinon'],
frameworks: ['mocha', 'sinon-chai'],

// list of files / patterns to load in the browser
files: [
Expand Down Expand Up @@ -37,37 +37,62 @@ module.exports = function (config) {
// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_WARN,

// enable / disable colors in the output (reporters and logs)
colors: true,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
autoWatch: false,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
'Chrome'
// 'ChromeCanary',
// 'Firefox',
// 'Safari',
// 'PhantomJS'
'Chrome1280x1024'
],

customLaunchers: {
Chrome_travis_ci: {
Chrome1280x1024: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
// increased viewport is required for some tests (TODO fix tests)
// https://github.com/Leaflet/Leaflet/issues/7113#issuecomment-619528577
flags: ['--window-size=1280,1024']
},
FirefoxTouch: {
base: 'FirefoxHeadless',
prefs: {
'dom.w3c_touch_events.enabled': 1
}
},
FirefoxNoTouch: {
base: 'FirefoxHeadless',
prefs: {
'dom.w3c_touch_events.enabled': 0
}
}
},

concurrency: 1,

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,

// Timeout for the client socket connection [ms].
browserSocketTimeout: 30000,

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

client: {
mocha: {
// eslint-disable-next-line no-undef
forbidOnly: process.env.CI || false
}
},

// Configure the coverage reporters
coverageReporter: {
reporters: [
Expand All @@ -81,9 +106,5 @@ module.exports = function (config) {
}
};

if (process.env.TRAVIS) {
configuration.browsers = ['Chrome_travis_ci'];
}

config.set(configuration);
};
Loading