-
-
Notifications
You must be signed in to change notification settings - Fork 8
59 lines (48 loc) · 1.99 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Build cht-couch2pg and run unit test cases
on: [ push]
jobs:
build-and-test:
name: Build cht-couch2pg
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
matrix:
node-version: [ 8, 10, 12 ]
steps:
- name: Get Docker Hub username
id: get-docker-hub-username
run: echo '::set-output name=dockerhub_username::${{ secrets.CI_DOCKER_USERNAME }}'
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: dockermedic
password: ${{ secrets.DOCKER_WRITE_PASSWORD }}
if: steps.get-docker-hub-username.outputs.dockerhub_username
- name: Checkout branch
uses: actions/checkout@v2
- name: Build test image
run: docker-compose -f docker-compose.test.yml build --build-arg node_version=${{ matrix.node-version }} cht-couch2pg
- name: Run grunt Tests
run: docker-compose -f docker-compose.test.yml run cht-couch2pg grunt test
- name: Run entry point script Tests
run: docker-compose -f docker-compose.test.yml run cht-couch2pg ./tests/bash/bats/bin/bats /app/tests/bash/test.bats
- name: Get tags to apply to image
id: meta
uses: docker/metadata-action@v3
with:
images: medicmobile/cht-couch2pg
labels: |
org.opencontainers.image.title=cht-couch2pg
org.opencontainers.image.description= Software for creating read-only replicas of CouchDB data inside PostgreSQL
org.opencontainers.image.vendor=Medic
flavor: |
latest=auto
suffix=-node-${{matrix.node-version}}
- name: Build and Publish to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
push: ${{github.ref == 'refs/heads/main' || github.ref == 'refs/heads/arch-v3' || github.event.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: cht-couch2pg