@@ -5,8 +5,7 @@ name: Test and Release
55on :
66 push :
77 branches :
8- # This avoids having duplicate builds in non-forked PRs
9- - " master"
8+ - master
109 tags :
1110 # normal versions
1211 - " v[0-9]+.[0-9]+.[0-9]+"
@@ -21,69 +20,36 @@ jobs:
2120
2221 runs-on : ubuntu-latest
2322
24- strategy :
25- matrix :
26- node-version : [14.x]
27-
2823 steps :
29- - name : Checkout code
30- uses : actions/checkout@v2
31-
32- - name : Use Node.js ${{ matrix.node-version }}
33- uses : actions/setup-node@v1
24+ - uses : ioBroker/testing-action-check@v1
3425 with :
35- node-version : ${{ matrix.node-version }}
26+ node-version : ' 14.x'
27+ type-checking : true
28+ lint : true
3629
37- - name : Install Dependencies
38- run : npm ci
39-
40- - name : Perform a type check
41- run : npm run check:ts
42- env :
43- CI : true
44- # - name: Lint TypeScript code
45- # run: npm run lint
46- - name : Test package files
47- run : npm run test:package
4830
4931 # Runs adapter tests on all supported node versions and OSes
5032 adapter-tests :
5133 if : contains(github.event.head_commit.message, '[skip ci]') == false
5234
53- needs : [check-and-lint]
54-
5535 runs-on : ${{ matrix.os }}
5636 strategy :
5737 matrix :
5838 node-version : [12.x, 14.x, 16.x]
5939 os : [ubuntu-latest, windows-latest, macos-latest]
6040
6141 steps :
62- - name : Checkout code
63- uses : actions/checkout@v2
64-
65- - name : Use Node.js ${{ matrix.node-version }}
66- uses : actions/setup-node@v1
42+ - uses : ioBroker/testing-action-adapter@v1
6743 with :
6844 node-version : ${{ matrix.node-version }}
45+ os : ${{ matrix.os }}
46+ build : true
47+ extra-tests : ' npm run test:ts'
6948
70- - name : Install Dependencies
71- run : npm ci
72-
73- - name : Run local tests
74- run : npm test
75- - name : Run unit tests
76- run : npm run test:unit
77- - name : Run integration tests (unix only)
78- if : startsWith(runner.OS, 'windows') == false
79- run : DEBUG=testing:* npm run test:integration
80- - name : Run integration tests (windows only)
81- if : startsWith(runner.OS, 'windows')
82- run : set DEBUG=testing:* & npm run test:integration
8349
8450 # Deploys the final package to NPM
8551 deploy :
86- needs : [adapter-tests]
52+ needs : [check-and-lint, adapter-tests]
8753
8854 # Trigger this step only when a commit on any branch is tagged with a version number
8955 if : |
@@ -92,52 +58,11 @@ jobs:
9258 startsWith(github.ref, 'refs/tags/v')
9359
9460 runs-on : ubuntu-latest
95- strategy :
96- matrix :
97- node-version : [14.x]
9861
9962 steps :
100- - name : Checkout code
101- uses : actions/checkout@v2
102-
103- - name : Use Node.js ${{ matrix.node-version }}
104- uses : actions/setup-node@v1
105- with :
106- node-version : ${{ matrix.node-version }}
107-
108- - name : Extract the version and commit body from the tag
109- id : extract_release
110- # The body may be multiline, therefore we need to escape some characters
111- run : |
112- VERSION="${{ github.ref }}"
113- VERSION=${VERSION##*/v}
114- echo "::set-output name=VERSION::$VERSION"
115- BODY=$(git show -s --format=%b)
116- BODY="${BODY//'%'/'%25'}"
117- BODY="${BODY//$'\n'/'%0A'}"
118- BODY="${BODY//$'\r'/'%0D'}"
119- echo "::set-output name=BODY::$BODY"
120-
121- - name : Install Dependencies
122- run : npm ci
123-
124- - name : Create a clean build
125- run : npm run build
126-
127- - name : Publish package to npm
128- run : |
129- npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
130- npm whoami
131- npm publish
132-
133- - name : Create Github Release
134- uses : actions/create-release@v1
135- env :
136- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63+ - uses : ioBroker/testing-action-deploy@v1
13764 with :
138- tag_name : ${{ github.ref }}
139- release_name : Release v${{ steps.extract_release.outputs.VERSION }}
140- draft : false
141- # Prerelease versions create prereleases on Github
142- prerelease : ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
143- body : ${{ steps.extract_release.outputs.BODY }}
65+ node-version : " 14.x" # This should be LTS
66+ build : ' true'
67+ npm-token : ${{ secrets.NPM_TOKEN }}
68+ github-token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments