Skip to content

feat: test with single raw values (#126) #35

feat: test with single raw values (#126)

feat: test with single raw values (#126) #35

Workflow file for this run

name: CI/CD
on:
push:
tags:
- v*
branches:
- main
pull_request:
branches:
- main
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup nodejs version
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
- name: Install dependencies
run: npm ci
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: >-
${{ runner.os }}-build-${{ env.cache-name }}-${{
hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
unit-tests:
runs-on: ubuntu-latest
needs: setup
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup nodejs version
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test:ci
- name: Report Coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
file-coverage-mode: all
deploy-to-docker:
runs-on: ubuntu-latest
needs:
- setup
- unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v5
with:
images: joschi64/mqtt-prometheus-gateway
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Call deployment webhook if it exists
env:
url: ${{ secrets.DEPLOYMENT_WEBHOOK }}
if: ${{ env.url != '' }}
run: |-
sed s/https/http/ <<< $url
curl -X POST $url