@@ -3,152 +3,114 @@ name: Test and Release
3
3
# Run this job on all pushes and pull requests
4
4
# as well as tags with a semantic version
5
5
on :
6
- push :
7
- branches :
8
- - " *"
9
- tags :
10
- # normal versions
11
- - " v[0-9]+.[0-9]+.[0-9]+"
12
- # pre-releases
13
- - " v[0-9]+.[0-9]+.[0-9]+-**"
14
- pull_request : {}
6
+ push :
7
+ branches :
8
+ - " *"
9
+ tags :
10
+ # normal versions
11
+ - " v[0-9]+.[0-9]+.[0-9]+"
12
+ # pre-releases
13
+ - " v[0-9]+.[0-9]+.[0-9]+-**"
14
+ pull_request : {}
15
15
16
16
jobs :
17
- # Performs quick checks before the expensive test runs
18
- check-and-lint :
19
- if : contains(github.event.head_commit.message, '[skip ci]') == false
20
-
21
- runs-on : ubuntu-latest
22
-
23
- strategy :
24
- matrix :
25
- node-version : [18.x, 20.x, 22.x]
26
-
27
- steps :
28
- - name : Checkout code
29
- uses : actions/checkout@v2
30
-
31
- - name : Use Node.js ${{ matrix.node-version }}
32
- uses : actions/setup-node@v1
33
- with :
34
- node-version : ${{ matrix.node-version }}
35
-
36
- - name : Install Dependencies
37
- run : npm install
38
-
39
- - name : Lint source code
40
- run : npm run lint
41
- - name : Test package files
42
- run : npm run test:package
43
-
44
- # Runs adapter tests on all supported node versions and OSes
45
- adapter-tests :
46
- if : contains(github.event.head_commit.message, '[skip ci]') == false
47
-
48
- needs : [check-and-lint]
49
-
50
- runs-on : ${{ matrix.os }}
51
- strategy :
52
- matrix :
53
- node-version : [18.x, 20.x, 22.x]
54
- os : [ubuntu-latest, windows-latest, macos-latest]
55
-
56
- steps :
57
- - name : Checkout code
58
- uses : actions/checkout@v2
59
-
60
- - name : Use Node.js ${{ matrix.node-version }}
61
- uses : actions/setup-node@v1
62
- with :
63
- node-version : ${{ matrix.node-version }}
64
-
65
- - name : Install Dependencies
66
- run : npm install
67
-
68
- - name : Run unit tests
69
- run : npm run test:unit
70
-
71
- - name : Run integration tests (unix only)
72
- if : startsWith(runner.OS, 'windows') == false
73
- run : DEBUG=testing:* npm run test:integration
74
-
75
- - name : Run integration tests (windows only)
76
- if : startsWith(runner.OS, 'windows')
77
- run : set DEBUG=testing:* & npm run test:integration
78
- # TODO: To enable automatic npm releases, create a token on npmjs.org
79
- # Enter this token as a GitHub secret (with name NPM_TOKEN) in the repository options
80
- # Then uncomment the following block:
81
-
82
- # # Deploys the final package to NPM
83
- # deploy:
84
- # needs: [adapter-tests]
85
- #
86
- # # Trigger this step only when a commit on any branch is tagged with a version number
87
- # if: |
88
- # contains(github.event.head_commit.message, '[skip ci]') == false &&
89
- # github.event_name == 'push' &&
90
- # startsWith(github.ref, 'refs/tags/v')
91
- #
92
- # runs-on: ubuntu-latest
93
- # strategy:
94
- # matrix:
95
- # node-version: [14.x]
96
- #
97
- # steps:
98
- # - name: Checkout code
99
- # uses: actions/checkout@v2
100
- #
101
- # - name: Use Node.js ${{ matrix.node-version }}
102
- # uses: actions/setup-node@v1
103
- # with:
104
- # node-version: ${{ matrix.node-version }}
105
- #
106
- # - name: Extract the version and commit body from the tag
107
- # id: extract_release
108
- # # The body may be multiline, therefore newlines and % need to be escaped
109
- # run: |
110
- # VERSION="${{ github.ref }}"
111
- # VERSION=${VERSION##*/v}
112
- # echo "::set-output name=VERSION::$VERSION"
113
- # BODY=$(git show -s --format=%b)
114
- # BODY="${BODY//'%'/'%25'}"
115
- # BODY="${BODY//$'\n'/'%0A'}"
116
- # BODY="${BODY//$'\r'/'%0D'}"
117
- # echo "::set-output name=BODY::$BODY"
118
- #
119
- # - name: Publish package to npm
120
- # run: |
121
- # npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
122
- # npm whoami
123
- # npm publish
124
- #
125
- # - name: Create Github Release
126
- # uses: actions/create-release@v1
127
- # env:
128
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129
- # with:
130
- # tag_name: ${{ github.ref }}
131
- # release_name: Release v${{ steps.extract_release.outputs.VERSION }}
132
- # draft: false
133
- # # Prerelease versions create prereleases on Github
134
- # prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
135
- # body: ${{ steps.extract_release.outputs.BODY }}
136
- #
137
- # # When using Sentry for error reporting, Sentry could be informed about new releases
138
- # # To enable create a API-Token in Sentry (User settings, API keys)
139
- # # Enter this token as a GitHub secret (with name SENTRY_AUTH_TOKEN) in the repository options
140
- # # Then uncomment and customize the following block:
141
- # #- name: Notify Sentry.io about the release
142
- # # run: |
143
- # # npm i -g @sentry/cli
144
- # # export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
145
- # # export SENTRY_URL=https://sentry.iobroker.net
146
- # # export SENTRY_ORG=iobroker
147
- # # export SENTRY_PROJECT=iobroker-ford
148
- # # export SENTRY_VERSION=iobroker.ford@${{ steps.extract_release.outputs.VERSION }}
149
- # # sentry-cli releases new $SENTRY_VERSION
150
- # # sentry-cli releases finalize $SENTRY_VERSION
151
- # # # Add the following line BEFORE finalize if repositories are connected in Sentry
152
- # # #sentry-cli releases set-commits $SENTRY_VERSION --auto
153
- # # # Add the following line BEFORE finalize if sourcemap uploads are needed
154
- # # #sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/
17
+ # Performs quick checks before the expensive test runs
18
+ check-and-lint :
19
+ if : contains(github.event.head_commit.message, '[skip ci]') == false
20
+
21
+ runs-on : ubuntu-latest
22
+
23
+ strategy :
24
+ matrix :
25
+ node-version : [18.x, 20.x, 22.x]
26
+
27
+ steps :
28
+ - uses : actions/checkout@v1
29
+ - name : Use Node.js ${{ matrix.node-version }}
30
+ uses : actions/setup-node@v1
31
+ with :
32
+ node-version : ${{ matrix.node-version }}
33
+
34
+ - name : Install Dependencies
35
+ run : npm ci
36
+
37
+ - name : Lint source code
38
+ run : npm run lint
39
+ - name : Test package files
40
+ run : npm run test:package
41
+
42
+ # Runs adapter tests on all supported node versions and OSes
43
+ adapter-tests :
44
+ if : contains(github.event.head_commit.message, '[skip ci]') == false
45
+
46
+ needs : [check-and-lint]
47
+
48
+ runs-on : ${{ matrix.os }}
49
+ strategy :
50
+ matrix :
51
+ node-version : [18.x, 20.x, 22.x]
52
+ os : [ubuntu-latest, windows-latest, macos-latest]
53
+ exclude :
54
+ # Don't test Node.js 8 on Windows. npm is weird here
55
+ - os : windows-latest
56
+ node-version : 8.x
57
+ steps :
58
+ - uses : actions/checkout@v1
59
+ - name : Use Node.js ${{ matrix.node-version }}
60
+ uses : actions/setup-node@v1
61
+ with :
62
+ node-version : ${{ matrix.node-version }}
63
+
64
+ - name : Install Dependencies
65
+ run : npm ci
66
+
67
+ - name : Run unit tests
68
+ run : npm run test:unit
69
+
70
+ - name : Run integration tests (unix only)
71
+ if : startsWith(runner.OS, 'windows') == false
72
+ run : DEBUG=testing:* npm run test:integration
73
+
74
+ - name : Run integration tests (windows only)
75
+ if : startsWith(runner.OS, 'windows')
76
+ run : set DEBUG=testing:* & npm run test:integration
77
+
78
+ # TODO: To enable automatic npm releases, create a token on npmjs.org
79
+ # Enter this token as a GitHub secret (with name NPM_TOKEN) in the repository options
80
+ # Then uncomment the following block:
81
+
82
+ # Deploys the final package to NPM
83
+ deploy :
84
+ needs : [adapter-tests]
85
+
86
+ # Trigger this step only when a commit on master is tagged with a version number
87
+ if : |
88
+ contains(github.event.head_commit.message, '[skip ci]') == false &&
89
+ github.event_name == 'push' &&
90
+ startsWith(github.ref, 'refs/tags/v')
91
+
92
+ runs-on : ubuntu-latest
93
+ strategy :
94
+ matrix :
95
+ node-version : [20.x]
96
+
97
+ steps :
98
+ - uses : actions/checkout@v1
99
+ - name : Use Node.js ${{ matrix.node-version }}
100
+ uses : actions/setup-node@v1
101
+ with :
102
+ node-version : ${{ matrix.node-version }}
103
+
104
+ - name : Publish package to npm
105
+ run : |
106
+ npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
107
+ npm whoami
108
+ npm publish
109
+
110
+ # Dummy job for skipped builds - without this, github reports the build as failed
111
+ skip-ci :
112
+ if : contains(github.event.head_commit.message, '[skip ci]')
113
+ runs-on : ubuntu-latest
114
+ steps :
115
+ - name : Skip build
116
+ run : echo "Build skipped!"
0 commit comments