Skip to content

Commit

Permalink
Merge pull request #153 from line-o/fix/ci-setup
Browse files Browse the repository at this point in the history
fix(ci): improve workflows
  • Loading branch information
line-o authored Jun 29, 2021
2 parents dbaf2ef + 48a616d commit 833ffec
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 47 deletions.
21 changes: 21 additions & 0 deletions .github/actions/setup-existdb/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Setup eXist-db"
description: "Start an exist-db instance running in a docker container"
inputs:
docker-tag:
description: "Tag of the existdb docker"
required: true
default: "release"

runs:
using: "composite"
steps:
- id: setup
run: |
docker pull existdb/existdb:${{ inputs.docker-tag }}
docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:${{ inputs.docker-tag }}
docker start exist-ci
shell: bash
# TODO this should rather be polling for a running container / a running service
- id: wait-to-exist
run: sleep 30
shell: bash
56 changes: 35 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,48 @@ on:
branches:
- master

# Tests cannot run on windows due to issues with the windows server 2019 images
# the github action runners are using not being able to run linux docker images
# https://github.com/actions/virtual-environments/issues/1143

jobs:
release:
name: Release
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: ['10', '12', '14']
docker-tag: [latest, release, 4.7.1]

steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: "14.x"

- name: npm install and build
run:
npm ci

- name: Pull docker image
run: docker pull existdb/existdb:release
node-version: ${{ matrix.node-version }}
- uses: ./.github/actions/setup-existdb
with:
docker-tag: ${{ matrix.docker-tag }}

- name: Build docker image
run: docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:release
- name: Install
run: npm ci

- name: Start docker image
run: docker start exist-ci
- name: Test
run: npm test

- name: Wait for existdb startup
run: sleep 30
release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'

- run: npm test
- run: npx semantic-release
- name: Release package to npmjs
run: |
npm ci
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 14 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,35 @@
name: test node-exist
name: Test Pull Request

on:
pull_request:
branches:
- master

push:
branches:
- master

workflow_dispatch:
# Tests cannot run on windows due to issues with the windows server 2019 images
# the github action runners are using not being able to run linux docker images
# https://github.com/actions/virtual-environments/issues/1143

jobs:
build:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [10.x, 12.x, 14.x]
os: [ubuntu-latest]
node-version: ['10', '12', '14']
docker-tag: [latest, release, 4.7.1]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: ./.github/actions/setup-existdb
with:
docker-tag: ${{ matrix.docker-tag }}

- name: npm install and build
- name: Install
run: npm ci

- name: Pull docker image
run: docker pull existdb/existdb:${{ matrix.docker-tag }}

- name: Build docker image
run: docker create --name exist-ci -p 8080:8080 -p 8443:8443 existdb/existdb:${{ matrix.docker-tag }}

- name: Start docker image
run: docker start exist-ci

- name: Wait for existdb startup
run: sleep 20

- name: npm test
run: npm test
- name: Test
run: npm test

0 comments on commit 833ffec

Please sign in to comment.