Skip to content

Commit 9d77429

Browse files
ci: Update workflows (#36)
1 parent f4c64a6 commit 9d77429

File tree

6 files changed

+90
-26
lines changed

6 files changed

+90
-26
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ updates:
99
commit-message:
1010
prefix: "chore"
1111
include: "scope"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: daily
16+
time: "11:00"
17+
open-pull-requests-limit: 10
18+
commit-message:
19+
prefix: "chore"
20+
include: "scope"

.github/workflows/pr-title.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
name: Conventional Commits
22
on:
33
pull_request:
4-
4+
types: [opened, edited, synchronize, reopened]
55

66
jobs:
77
lint:
8-
name: https://www.conventionalcommits.org
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: beemojs/conventional-pr-action@v2
12-
with:
13-
config-preset: angular
14-
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8+
uses: appium/appium-workflows/.github/workflows/pr-title.yml@main
9+
with:
10+
config-preset: angular
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Reenable this workflow as soon as the project is moved under the Appium org in npmjs
2+
3+
name: Release
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches: [ master ]
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
issues: write
14+
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: lts/*
25+
- run: npm install --no-package-lock
26+
name: Install dependencies
27+
- run: npm run test
28+
name: Run NPM Test
29+
- run: |
30+
rm -rf package-lock.json node_modules
31+
# Remove dev dependencies from node_modules
32+
npm prune --omit=dev --no-package-lock
33+
name: Remove dev dependencies
34+
- run: npm shrinkwrap --omit=dev
35+
name: Create shrinkwrap
36+
- run: npm install --only=dev --no-package-lock
37+
name: Install dev dependencies for the release
38+
- run: npx semantic-release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
name: Release
42+

.github/workflows/unit-test.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
name: Unit Tests
22

3-
on: [pull_request, push]
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
paths-ignore:
7+
- 'docs/**'
8+
- '*.md'
9+
push:
10+
branches: [ master ]
11+
paths-ignore:
12+
- 'docs/**'
13+
- '*.md'
414

515

616
jobs:
7-
prepare_matrix:
8-
runs-on: ubuntu-latest
9-
outputs:
10-
versions: ${{ steps.generate-matrix.outputs.versions }}
11-
steps:
12-
- name: Select 3 most recent LTS versions of Node.js
13-
id: generate-matrix
14-
run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:3] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT"
17+
node_matrix:
18+
uses: appium/appium-workflows/.github/workflows/node-lts-matrix.yml@main
1519

1620
test:
1721
needs:
18-
- prepare_matrix
22+
- node_matrix
1923
strategy:
24+
fail-fast: false
2025
matrix:
21-
node-version: ${{ fromJSON(needs.prepare_matrix.outputs.versions) }}
26+
node-version: ${{ fromJSON(needs.node_matrix.outputs.versions) }}
2227
runs-on: ubuntu-latest
2328
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-node@v3
29+
- uses: actions/checkout@v6
30+
- uses: actions/setup-node@v6
2631
with:
2732
node-version: ${{ matrix.node-version }}
28-
- run: npm install --no-package-lock
33+
check-latest: true
34+
- uses: SocketDev/action@v1
35+
with:
36+
mode: firewall-free
37+
- run: sfw npm install --no-package-lock
2938
name: Install dev dependencies
3039
- run: npm run lint
3140
name: Run linter

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"es7",
77
"async"
88
],
9-
"version": "2.9.3",
9+
"version": "3.0.0",
1010
"author": "jlipps@gmail.com",
1111
"license": "Apache-2.0",
1212
"repository": {
@@ -46,13 +46,17 @@
4646
"devDependencies": {
4747
"@appium/eslint-config-appium-ts": "^2.0.5",
4848
"@appium/tsconfig": "^0.x",
49+
"@semantic-release/changelog": "^6.0.1",
50+
"@semantic-release/git": "^10.0.1",
4951
"@types/bluebird": "^3.5.37",
5052
"@types/lodash": "^4.14.189",
5153
"@types/node": "^20.4.7",
5254
"chai": "^4.2.0",
5355
"chai-as-promised": "^7.1.1",
56+
"conventional-changelog-conventionalcommits": "^9.0.0",
5457
"eslint": "^9.39.1",
5558
"mocha": "^10.0.0",
59+
"semantic-release": "^25.0.2",
5660
"sinon": "^16.0.0",
5761
"ts-node": "^10.9.1",
5862
"typescript": "^5.1.6"

test/asyncbox-specs.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ describe('retry', function () {
8686
}
8787
return times * times;
8888
};
89+
beforeEach(function () {
90+
okFnCalls = 0;
91+
badFnCalls = 0;
92+
eventuallyOkFnCalls = 0;
93+
});
8994
it('should return the result of a passing function', async function () {
9095
let start = Date.now();
9196
let res = await retry(3, okFn, 5, 4);
@@ -104,7 +109,7 @@ describe('retry', function () {
104109
should.exist(err);
105110
err.message.should.equal('bad');
106111
badFnCalls.should.equal(3);
107-
(Date.now() - start).should.be.above(44);
112+
(Date.now() - start).should.be.least(44);
108113
});
109114
it('should return the correct value with a function that eventually passes', async function () {
110115
let err = null;
@@ -140,7 +145,7 @@ describe('retry', function () {
140145
should.exist(err);
141146
err.message.should.equal('not ok yet');
142147
eventuallyOkFnCalls.should.equal(3);
143-
(Date.now() - start).should.be.above(30);
148+
(Date.now() - start).should.be.least(30);
144149

145150
// rerun with ok number of calls
146151
start = Date.now();

0 commit comments

Comments
 (0)