From d431b245dddae66c1d251d1b219131af14450bb0 Mon Sep 17 00:00:00 2001 From: mehdi Date: Sat, 16 Oct 2021 00:03:33 +0200 Subject: [PATCH 1/7] test github actions --- .github/workflows/github-actions-demo.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..711d62e --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,17 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v2 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." From 0b82e59845d376a4029f29b68a74cd1c2a1cc939 Mon Sep 17 00:00:00 2001 From: mehdi Date: Sat, 16 Oct 2021 00:09:31 +0200 Subject: [PATCH 2/7] node tests --- .github/workflows/github-actions-demo.yml | 37 ++++++++++++++--------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 711d62e..1adbcb9 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,17 +1,26 @@ -name: GitHub Actions Demo -on: [push] +name: Node tests + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + jobs: - Explore-GitHub-Actions: + build: runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run lint + - run: npm run test From 501fd7e4e76b39f992d7dbf5af72f9f5b7403043 Mon Sep 17 00:00:00 2001 From: mehdi Date: Sat, 16 Oct 2021 00:14:05 +0200 Subject: [PATCH 3/7] fix action trigger --- .github/workflows/github-actions-demo.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 1adbcb9..1486680 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,10 +1,6 @@ name: Node tests -on: - push: - branches: [ $default-branch ] - pull_request: - branches: [ $default-branch ] +on: [push, pull_request] jobs: build: From a400f87466cacc5f4e50fc0b19977109c7c9d7ad Mon Sep 17 00:00:00 2001 From: mehdi Date: Sat, 16 Oct 2021 00:48:59 +0200 Subject: [PATCH 4/7] add browser tests --- .github/workflows/github-actions-demo.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 1486680..8d5b3a0 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,9 +1,9 @@ -name: Node tests +name: Tests on: [push, pull_request] jobs: - build: + node-tests: runs-on: ubuntu-latest strategy: @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} @@ -20,3 +20,19 @@ jobs: - run: npm ci - run: npm run lint - run: npm run test + + browser-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Node.js 14 + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: 'npm' + - name: Install Chrome Stable + uses: browser-actions/setup-chrome@latest + - run: npm ci + - run: npm run lint + - run: npm run test:browser From b2f2f0e563ec1569e8f624126c89077fc73f7913 Mon Sep 17 00:00:00 2001 From: mehdi Date: Tue, 19 Oct 2021 01:23:02 +0200 Subject: [PATCH 5/7] publish action --- .github/workflows/publish.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7da64e7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish Package +on: + release: + types: [created] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm run prepublishOnly + - id: get_npm_label + run: if (npx semver ${{ github.event.release.tag_name }} --range '>0.0.0'); then echo ::set-output name=NPM_LABEL::latest; else echo ::set-output name=NPM_LABEL::beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges + - run: npm publish --tag=${NPM_LABEL} --access public + env: + NPM_LABEL: ${{ steps.get_npm_label.outputs.NPM_LABEL }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 238369c3068e4096e0df371a023c7b338bbb959a Mon Sep 17 00:00:00 2001 From: mehdi Date: Tue, 19 Oct 2021 01:50:14 +0200 Subject: [PATCH 6/7] try some undocumented syntax found in forums --- .github/workflows/publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7da64e7..bca7370 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,8 @@ name: Publish Package on: - release: - types: [created] + push: + tags: + - '*' jobs: build: runs-on: ubuntu-latest From 1e71d253f95fad055e5574d85210b02de6bdc3bb Mon Sep 17 00:00:00 2001 From: mehdi Date: Tue, 19 Oct 2021 01:59:47 +0200 Subject: [PATCH 7/7] remove obsolete gitlab-ci.yml --- .gitlab-ci.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 558b895..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -stages: - - test - - test-browser - - deploy - -image: node:14 - -before_script: - - echo "//registry.npmjs.org/:_authToken=${NPM_REGISTRY_TOKEN}" > .npmrc - - npm ci --cache .npm --prefer-offline - -cache: - key: "nedb" # universal cache - paths: - - .npm/ - -test: - stage: test - script: - - npm run lint - - npm run test - -test-browser: - image: nexus-docker.tardis.seald.io/seald/docker-browser-testing:CHROME_88 - stage: test-browser - script: npm run test:browser - -deploy: - stage: deploy - script: - - npm run prepublishOnly - - if (npx semver $CI_COMMIT_TAG --range '>0.0.0'); then NPM_TAG=latest; else NPM_TAG=beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges - - npm publish --tag=$NPM_TAG --access public - only: - - tags