Skip to content

Merge pull request #14 from endlessm/dependabot/npm_and_yarn/chai-dat… #37

Merge pull request #14 from endlessm/dependabot/npm_and_yarn/chai-dat…

Merge pull request #14 from endlessm/dependabot/npm_and_yarn/chai-dat… #37

Workflow file for this run

# Copyright © 2016-2024 Endless OS Foundation LLC
# SPDX-License-Identifier: GPL-2.0-or-later
name: EOS Activation Server Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
IMAGE: endlessm/eos-activation-server
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
pull: true
tags: test-server:latest
- name: Run Redis
run: docker run -d --rm --network=host --name=redis redis:5-alpine
- name: Run server
run: docker run -d --rm --network=host --name=server test-server:latest
- name: Run tests
run: docker run --rm --network=host test-server:latest npm test
- name: Stop server
run: docker stop server
- name: Stop Redis
run: docker stop redis
- name: Build and push to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}