From ca5d70be63468a8cb1019723da18a15dc17f9adf Mon Sep 17 00:00:00 2001 From: Muhammad Yasser Jazirahly Date: Tue, 24 Dec 2024 15:08:40 +0400 Subject: [PATCH 1/3] Added Github Actions workflow to run npm test script Also replaced phantomjs with chrome headless as a part of modernizing the test setup. --- .github/workflows/ci.yaml | 42 +++++++++++++++++++++++++++++++++++++++ karma.conf.js | 14 ++++++++++++- package.json | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ab9b2ec --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,42 @@ +name: Lint and Test + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10, 12, 14] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup Chrome + uses: browser-actions/setup-chrome@latest + with: + chrome-version: stable + + - name: Configure Chrome Sandbox + run: | + sudo chown root:root /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox + sudo chmod 4755 /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox + + - name: Install dependencies + run: npm install + + - name: Run ESLint and tests + run: npm test + env: + CHROME_BIN: chrome + CHROME_FLAGS: --no-sandbox --headless --disable-gpu \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index d471843..855c030 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -31,6 +31,18 @@ module.exports = function ( config ) { port: 9876, logLevel: config.LOG_INFO, - browsers: [ 'PhantomJS' ] + browsers: [ 'ChromeHeadless' ], + customLaunchers: { + ChromeHeadless: { + base: 'Chrome', + flags: [ + '--no-sandbox', + '--headless', + '--disable-gpu', + '--disable-dev-shm-usage', + '--disable-software-rasterizer' + ] + } + } } ); }; diff --git a/package.json b/package.json index f5c88b0..63d3ec1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "eslint-config-wikimedia": "0.4.0", "karma": "^6.1.0", "karma-cli": "^1.0.1", - "karma-phantomjs-launcher": "^1.0.4", + "karma-chrome-launcher": "^3.1.0", "karma-qunit": "^4.1.2", "qunit": "^2.14.0" }, From c033c1402e890dc6fa60ffab9fc857c3e8579528 Mon Sep 17 00:00:00 2001 From: Muhammad Yasser Jazirahly Date: Tue, 24 Dec 2024 15:19:29 +0400 Subject: [PATCH 2/3] removed Travis CI config --- .travis.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4450a80..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: node_js - -node_js: -- 10 -- 12 -- 14 - -before_script: - - npm install - -script: - - npm test - -notifications: - irc: - channels: - - "irc.libera.chat#wikidata-feed" - on_success: change - on_failure: always - template: - - "%{repository}/%{branch}/%{commit} : %{author} %{message} %{build_url}" - From 226540bac00448dc2abbb3d34fcd5b17d99d2cbd Mon Sep 17 00:00:00 2001 From: Leszek Manicki Date: Wed, 8 Jan 2025 13:11:39 +0100 Subject: [PATCH 3/3] Run Github action CI workflow on all pushes and pull requests --- .github/workflows/ci.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ab9b2ec..f695c26 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,10 +1,6 @@ name: Lint and Test -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: test: @@ -39,4 +35,4 @@ jobs: run: npm test env: CHROME_BIN: chrome - CHROME_FLAGS: --no-sandbox --headless --disable-gpu \ No newline at end of file + CHROME_FLAGS: --no-sandbox --headless --disable-gpu