Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit 7bbbc5d

Browse files
committed
add github actions workflow
1 parent 5e21067 commit 7bbbc5d

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

.github/workflows/main.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "*" # run for branches
7+
tags:
8+
- "*" # run for tags
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
env:
14+
GROUP: weaveworksdemos
15+
COMMIT: ${{ github.sha }}
16+
REPO: front-end
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
#
21+
#
22+
# Set up node
23+
- uses: actions/setup-node@v1
24+
with:
25+
node-version: '4.x'
26+
27+
#
28+
#
29+
# Install dependencies
30+
- run: npm install
31+
32+
#
33+
#
34+
# Run node tests in docker image
35+
- name: Test image
36+
env:
37+
DOCKER_BUILDKIT: 1
38+
run: make test
39+
40+
#
41+
#
42+
# Build docker image for service
43+
- name: Build docker image
44+
uses: docker/build-push-action@v1
45+
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
46+
with:
47+
push: false
48+
repository: ${{ env.GROUP }}/${{ env.REPO }}
49+
tag_with_ref: true
50+
tag_with_sha: true
51+
tags: ${{ github.sha }}
52+
53+
#
54+
#
55+
# Run simple test against built container
56+
- name: Test docker image
57+
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
58+
env:
59+
DOCKER_BUILDKIT: 1
60+
run: ./test/container.sh
61+
62+
#
63+
#
64+
# Push to dockerhub
65+
- name: Push to Docker Hub
66+
uses: docker/build-push-action@v1
67+
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
68+
with:
69+
username: ${{ secrets.DOCKER_USERNAME }}
70+
password: ${{ secrets.DOCKER_PASSWORD }}
71+
repository: ${{ env.GROUP }}/${{ env.REPO }}
72+
tag_with_ref: true
73+
tag_with_sha: true

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
IMAGE=front-end
2+
DOCKER_IFLAG := $(if $(GITHUB_ACTIONS),"-i","-it")
23

34
.PHONY: test coverage
45

@@ -46,7 +47,7 @@ test-image:
4647
test: test-image
4748
@docker run \
4849
--rm \
49-
-it \
50+
$(DOCKER_IFLAG) \
5051
-v $$PWD:/usr/src/app \
5152
$(IMAGE) /usr/local/bin/npm test
5253

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Build Status](https://travis-ci.org/microservices-demo/front-end.svg?branch=master)](https://travis-ci.org/microservices-demo/front-end)
22
[![](https://images.microbadger.com/badges/image/weaveworksdemos/front-end.svg)](http://microbadger.com/images/weaveworksdemos/front-end "Get your own image badge on microbadger.com")
3+
[![Actions Status](https://github.com/microservices-demo/front-end/workflows/ci/badge.svg)](https://github.com/microservices-demo/front-end/workflows/ci/badge.svg)
34

45

56
Front-end app

0 commit comments

Comments
 (0)