Skip to content

Commit 36686f2

Browse files
authored
Merge pull request #633 from nextcloud/chore/update-ci
Update CI workflows from organization templates
2 parents 8e70f7f + aef0573 commit 36686f2

File tree

8 files changed

+187
-156
lines changed

8 files changed

+187
-156
lines changed

.github/workflows/doc-publish.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Documentation
2+
3+
on:
4+
pull_request:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
name: Build and deploy
13+
steps:
14+
- name: Check actor permission level
15+
# Only allow admin to deploy on release
16+
if: github.event.release
17+
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2
18+
with:
19+
require: admin
20+
21+
- name: Checkout
22+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
23+
24+
- name: Read package.json node and npm engines version
25+
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
26+
id: versions
27+
with:
28+
fallbackNode: '^20'
29+
fallbackNpm: '^9'
30+
31+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
32+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
33+
with:
34+
node-version: ${{ steps.versions.outputs.nodeVersion }}
35+
36+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
37+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
38+
39+
- name: Install dependencies & build
40+
run: |
41+
npm ci
42+
npm run build --if-present
43+
npm run build:doc --if-present
44+
45+
- name: Deploy
46+
# Only deploy on release
47+
if: github.event.release
48+
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
publish_dir: ./dist/doc

.github/workflows/node-test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Node tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
- stable*
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: node-tests-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
25+
26+
- name: Read package.json node and npm engines version
27+
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
28+
id: versions
29+
with:
30+
fallbackNode: '^20'
31+
fallbackNpm: '^9'
32+
33+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
34+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
35+
with:
36+
node-version: ${{ steps.versions.outputs.nodeVersion }}
37+
38+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
39+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
40+
41+
- name: Install dependencies & build
42+
run: |
43+
npm ci
44+
npm run build --if-present
45+
46+
- name: Test
47+
run: npm run test --if-present
48+
49+
- name: Test and process coverage
50+
run: npm run test:coverage --if-present
51+
52+
- name: Collect coverage
53+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
54+
with:
55+
files: ./coverage/lcov.info
56+
57+
summary:
58+
runs-on: ubuntu-latest
59+
needs: test
60+
if: always()
61+
62+
name: test-summary
63+
steps:
64+
- name: Summary status
65+
run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi

.github/workflows/npm-publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Publish
7+
8+
on:
9+
release:
10+
types: [published]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
19+
name: Build and publish to npm
20+
steps:
21+
- name: Check actor permission level
22+
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
23+
with:
24+
require: admin
25+
26+
- name: Checkout
27+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
28+
29+
- name: Read package.json node and npm engines version
30+
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
31+
id: versions
32+
with:
33+
fallbackNode: '^20'
34+
fallbackNpm: '^9'
35+
36+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
37+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
38+
with:
39+
node-version: ${{ steps.versions.outputs.nodeVersion }}
40+
41+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
42+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
43+
44+
- name: Install dependencies & build
45+
run: |
46+
npm ci
47+
npm run build --if-present
48+
49+
- name: Publish
50+
run: |
51+
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
52+
npm publish
53+
env:
54+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
56+
- name: Setup Github Registry
57+
uses: actions/setup-node@v3
58+
with:
59+
registry-url: 'https://npm.pkg.github.com'
60+
61+
- name: Publish package on GPR
62+
run: npm publish
63+
env:
64+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Build Status](https://img.shields.io/github/actions/workflow/status/nextcloud/nextcloud-axios/tests.yml?branch=master)](https://github.com/nextcloud/nextcloud-axios/actions/workflows/tests.yml?query=branch%3Amaster)
44
[![npm](https://img.shields.io/npm/v/@nextcloud/axios.svg)](https://www.npmjs.com/package/@nextcloud/axios)
5+
[![code coverage](https://img.shields.io/codecov/c/github/nextcloud/nextcloud-axios)](https://app.codecov.io/gh/nextcloud/nextcloud-axios)
6+
57

68
Simple, typed wrapper of an Axios instance for Nextcloud that automatically sends authentication headers. [Cancellation](https://github.com/axios/axios#cancellation) is supported as well.
79

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
],
1717
"scripts": {
1818
"build": "rollup --config rollup.config.mjs",
19-
"check-types": "tsc",
2019
"dev": "rollup --config rollup.config.mjs --watch",
21-
"test": "jest --setupFiles '<rootDir>/test/setup.js'",
20+
"lint": "eslint lib test",
21+
"lint:fix": "eslint --fix lib test",
22+
"test": "jest --setupFiles '<rootDir>/test/setup.js' && npm run test:types",
23+
"test:coverage": "jest --setupFiles '<rootDir>/test/setup.js' --coverage",
24+
"test:types": "tsc --noEmit",
2225
"test:watch": "jest --setupFiles '<rootDir>/test/setup.js' --watchAll"
2326
},
2427
"repository": {

0 commit comments

Comments
 (0)