mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
* rollback compatibility issues for tests Revert "Bump jsonwebtoken from 8.5.1 to 9.0.0 (#7787)" This rolls back changes to node_modules via package-lock.json as a result of new dependencies. More work is needed before involving these changes. Without this rollback, the tests do consistently complete within the allowed time in a reproducible way. * Test Github Actions with jsdom 11.11.0 * Upgrade github actions as requested by the actions runner * Lock generated using 6.14.18 * Upgrade actions/checkout@v2 to v3 * restore jsonwebtoken upgrade Co-authored-by: Ben West <bewest@gmail.com>
90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
name: CI test and publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- dev
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- dev
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [14.x, 16.x]
|
|
mongodb-version: [4.4, 5.0, 6.0]
|
|
|
|
steps:
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Start MongoDB ${{ matrix.mongodb-version }}
|
|
uses: supercharge/mongodb-github-action@1.3.0
|
|
with:
|
|
mongodb-version: ${{ matrix.mongodb-version }}
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
- name: Run Tests
|
|
run: npm run-script test-ci
|
|
- name: Send Coverage
|
|
run: npm run-script coverage
|
|
|
|
publish:
|
|
name: Publish to Docker Hub
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') && github.repository_owner == 'nightscout'
|
|
env:
|
|
DOCKER_IMAGE: nightscout/cgm-remote-monitor
|
|
PLATFORMS: linux/amd64,linux/arm64
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
- name: Clean git Checkout
|
|
if: success()
|
|
uses: actions/checkout@v3
|
|
- name: Build, tag and push the dev Docker image
|
|
if: success() && github.ref == 'refs/heads/dev'
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
no-cache: true
|
|
platforms: ${{ env.PLATFORMS }}
|
|
tags: |
|
|
${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
|
|
${{ env.DOCKER_IMAGE }}:latest_dev
|
|
|
|
- name: Get Nightscout release version
|
|
if: success() && github.ref == 'refs/heads/master'
|
|
id: package-version
|
|
uses: martinbeentjes/npm-get-version-action@master
|
|
- name: Build, tag and push the master Docker image
|
|
if: success() && github.ref == 'refs/heads/master'
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
no-cache: true
|
|
platforms: ${{ env.PLATFORMS }}
|
|
tags: |
|
|
${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
|
|
${{ env.DOCKER_IMAGE }}:latest |