-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (79 loc) · 2.43 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
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
name: CI
on:
push:
branches:
- php
tags:
- 2.*.*
pull_request:
branches:
- php
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: prepare
uses: docker://ecoding/php:8.0
with:
args: composer install
- name: Lint
uses: docker://ecoding/php:8.0
with:
args: ./vendor/bin/phpcs --extensions=php --standard=PSR12 app/ tests/
- name: PHPMD
uses: docker://ecoding/php:8.0
with:
args: ./vendor/bin/phpmd . text phpmd.xml --exclude vendor
- name: test
uses: docker://ecoding/php:8.0
env:
XDEBUG_MODE: coverage
with:
args: ./vendor/bin/phpunit --coverage-clover coverage.xml --coverage-filter app/ tests/
- name: codecov
uses: codecov/codecov-action@v2
- name: GitHub Environment Variables Action
uses: FranzDiebold/github-env-vars-action@v2
- name: Set env
run: |
echo "APP_VERSION=$CI_SHA_SHORT" >> $GITHUB_ENV
- name: Set env when tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "APP_VERSION=$CI_ACTION_REF_NAME" >> $GITHUB_ENV
- name: build
uses: docker://ecoding/php:8.0
env:
APP_VERSION: ${{ env.APP_VERSION }}
with:
args: php coding app:build --build-version=${{ env.APP_VERSION }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: coding
path: builds/coding
- name: Set up Docker Buildx
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push
id: docker_build
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v2
env:
APP_VERSION: ${{ env.APP_VERSION }}
with:
push: true
context: .
tags: ecoding/coding-cli:latest,ecoding/coding-cli:${{ env.APP_VERSION }}
- name: Image digest
if: steps.docker_build.conclusion == 'success'
run: echo ${{ steps.docker_build.outputs.digest }}