This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (93 loc) · 2.81 KB
/
build-push-latest.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build, Test and Push
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Login To Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Pull latest image (for build cache)
run: docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/doctrine-event-sourcing-php:latest
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker Image
id: build-php
uses: ./.github/actions/build
with:
uname: dev
uid: 1001
gid: 1001
- name: Push Docker Image
run: |
IMAGE_TAG='${{ steps.build-php.outputs.image-tag }}'
docker push $IMAGE_TAG
echo $IMAGE_TAG
phpunit:
runs-on: ubuntu-20.04
needs:
- build-and-push
container: 'rela589n/doctrine-event-sourcing-php:${{ github.sha }}'
services:
test_db:
image: postgres:13-alpine
env:
POSTGRES_DB: des
POSTGRES_USER: des_user
POSTGRES_PASSWORD: p@$$w0rd
steps:
- uses: actions/checkout@v2
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Run Tests
uses: ./.github/actions/test
with:
coverage: 'true'
- name: DEBUG
run: pwd; ls -al; ls -al tests/;
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
build-push-latest:
runs-on: ubuntu-latest
needs:
- phpunit
steps:
- name: Login To Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Pull latest image (for build cache)
run: docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/doctrine-event-sourcing-php:latest
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker Image
id: build-php
uses: ./.github/actions/build
with:
uname: dev
uid: 1000
gid: 1000
- name: Push Docker Image
run: |
IMAGE_TAG='${{ steps.build-php.outputs.image-tag }}'
LATEST_TAG='${{ secrets.DOCKER_HUB_USERNAME }}/doctrine-event-sourcing-php:latest'
docker tag $IMAGE_TAG $LATEST_TAG
docker push $LATEST_TAG