From cc0e88598f4877a6a2833849f97c15bef2d7c4ad Mon Sep 17 00:00:00 2001 From: Stasia Michalska Date: Sat, 13 Dec 2025 00:50:23 +0100 Subject: [PATCH] Replace travis with github actions --- .github/dependabot.yml | 11 ++++++++++ .github/workflows/build.yml | 29 ++++++++++++++++++++++++++ .github/workflows/lint.yml | 23 +++++++++++++++++++++ .github/workflows/npm-publish.yml | 28 +++++++++++++++++++++++++ .github/workflows/test.yml | 34 +++++++++++++++++++++++++++++++ .travis.yml | 12 ----------- package.json | 2 +- 7 files changed, 126 insertions(+), 13 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/npm-publish.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b417983 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8db680a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + container: + image: ghcr.io/pebble-dev/pebbleos-docker:v1 + + steps: + - uses: actions/checkout@v4 + - name: Set up uv + uses: astral-sh/setup-uv@v7 + - run: uv tool install pebble-tool + - run: npm install + - run: npm run build + - run: pebble build + - uses: actions/upload-artifact@v4 + with: + name: clay + path: dist.zip + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0ff1f19 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: Lint CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - run: npm install + - run: npm run lint + diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..694aa48 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,28 @@ +name: Node.js Package + +on: + release: + types: [created] + +permissions: + id-token: write + contents: read + +jobs: + publish-npm: + runs-on: ubuntu-latest + + container: + image: ghcr.io/pebble-dev/pebbleos-docker:v1 + + steps: + - uses: actions/checkout@v4 + - name: Set up uv + uses: astral-sh/setup-uv@v7 + - run: uv tool install pebble-tool + - run: npm install + - run: npm run build + - run: pebble build + - name: Update npm + run: npm install -g npm@latest + - run: npm publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dc1833f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Setup Chrome + uses: browser-actions/setup-chrome@v2 + id: setup-chrome + with: + install-dependencies: true + - run: npm install + - run: npm run build + - name: Run headless test + uses: coactions/setup-xvfb@v1 + with: + run: npm run test-travis + env: + CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }} + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 203d78e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -sudo: false -node_js: - - '4' - -before_script: - # Needed to include Chrome in Travis for karma tests - - export CHROME_BIN=chromium-browser - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - -script: 'npm run test-travis' diff --git a/package.json b/package.json index 2b7a571..9014348 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.4", "description": "Pebble Config Framework", "scripts": { - "test-travis": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run --browsers chromeTravisCI && ./node_modules/.bin/eslint ./", + "test-travis": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run --browsers chromeTravisCI", "test-debug": "(export DEBUG=true && ./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --no-single-run)", "test": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run", "lint": "./node_modules/.bin/eslint ./",