Skip to content

Commit 833ffec

Browse files
authored
Merge pull request #153 from line-o/fix/ci-setup
fix(ci): improve workflows
2 parents dbaf2ef + 48a616d commit 833ffec

File tree

3 files changed

+70
-47
lines changed

3 files changed

+70
-47
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Setup eXist-db"
2+
description: "Start an exist-db instance running in a docker container"
3+
inputs:
4+
docker-tag:
5+
description: "Tag of the existdb docker"
6+
required: true
7+
default: "release"
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- id: setup
13+
run: |
14+
docker pull existdb/existdb:${{ inputs.docker-tag }}
15+
docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:${{ inputs.docker-tag }}
16+
docker start exist-ci
17+
shell: bash
18+
# TODO this should rather be polling for a running container / a running service
19+
- id: wait-to-exist
20+
run: sleep 30
21+
shell: bash

.github/workflows/release.yml

+35-21
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,48 @@ on:
55
branches:
66
- master
77

8+
# Tests cannot run on windows due to issues with the windows server 2019 images
9+
# the github action runners are using not being able to run linux docker images
10+
# https://github.com/actions/virtual-environments/issues/1143
11+
812
jobs:
9-
release:
10-
name: Release
11-
runs-on: ubuntu-latest
13+
test:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
node-version: ['10', '12', '14']
19+
docker-tag: [latest, release, 4.7.1]
20+
1221
steps:
13-
- uses: actions/checkout@master
14-
- uses: actions/setup-node@v1
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
1525
with:
16-
node-version: "14.x"
17-
18-
- name: npm install and build
19-
run:
20-
npm ci
21-
22-
- name: Pull docker image
23-
run: docker pull existdb/existdb:release
26+
node-version: ${{ matrix.node-version }}
27+
- uses: ./.github/actions/setup-existdb
28+
with:
29+
docker-tag: ${{ matrix.docker-tag }}
2430

25-
- name: Build docker image
26-
run: docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:release
31+
- name: Install
32+
run: npm ci
2733

28-
- name: Start docker image
29-
run: docker start exist-ci
34+
- name: Test
35+
run: npm test
3036

31-
- name: Wait for existdb startup
32-
run: sleep 30
37+
release:
38+
needs: test
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions/setup-node@v2
43+
with:
44+
node-version: '14'
3345

34-
- run: npm test
35-
- run: npx semantic-release
46+
- name: Release package to npmjs
47+
run: |
48+
npm ci
49+
npx semantic-release
3650
env:
3751
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3852
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+14-26
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,35 @@
1-
name: test node-exist
1+
name: Test Pull Request
22

33
on:
44
pull_request:
55
branches:
66
- master
77

8-
push:
9-
branches:
10-
- master
11-
12-
workflow_dispatch:
8+
# Tests cannot run on windows due to issues with the windows server 2019 images
9+
# the github action runners are using not being able to run linux docker images
10+
# https://github.com/actions/virtual-environments/issues/1143
1311

1412
jobs:
15-
build:
13+
test:
1614
runs-on: ${{ matrix.os }}
1715
strategy:
1816
matrix:
19-
os: [ubuntu-latest, windows-latest]
20-
node-version: [10.x, 12.x, 14.x]
17+
os: [ubuntu-latest]
18+
node-version: ['10', '12', '14']
2119
docker-tag: [latest, release, 4.7.1]
2220

2321
steps:
2422
- uses: actions/checkout@v2
25-
2623
- name: Use Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v2
2825
with:
2926
node-version: ${{ matrix.node-version }}
27+
- uses: ./.github/actions/setup-existdb
28+
with:
29+
docker-tag: ${{ matrix.docker-tag }}
3030

31-
- name: npm install and build
31+
- name: Install
3232
run: npm ci
3333

34-
- name: Pull docker image
35-
run: docker pull existdb/existdb:${{ matrix.docker-tag }}
36-
37-
- name: Build docker image
38-
run: docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:${{ matrix.docker-tag }}
39-
40-
- name: Start docker image
41-
run: docker start exist-ci
42-
43-
- name: Wait for existdb startup
44-
run: sleep 20
45-
46-
- name: npm test
47-
run: npm test
34+
- name: Test
35+
run: npm test

0 commit comments

Comments
 (0)