-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (128 loc) · 4.2 KB
/
php_lib_push_main.yml
File metadata and controls
130 lines (128 loc) · 4.2 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Create Github Release
on:
workflow_call:
inputs:
PHP_LINT:
description: 'Toggle for the PHP lint step'
required: false
default: true
type: boolean
# Some libraries don't have unit tests and thus don't vendor phpunit
PHP_UNIT:
description: 'Toggle for the PHP unit test step'
required: false
default: true
type: boolean
PHP_UNIT_TESTSUITE:
description: ''
required: false
default: ''
type: string
SETUP_PHP_EXTENSIONS:
description: 'The extensions to enable while setting up PHP (csv)'
required: false
default: ""
type: string
SETUP_PHP_TOOLS:
description: 'The tools to enable while setting up PHP (csv)'
required: false
default: "composer:v1"
type: string
SETUP_PHP_COVERAGE:
description: 'The coverage tool to enable while setting up PHP (csv)'
required: false
default: "xdebug"
type: string
COMPOSER_WORKING_DIRECTORY:
description: 'Working directory for installing composer and running linting and unit tests'
required: false
default: "."
type: string
COMPOSER_OPTIONS:
description: 'composer options to use'
required: false
default: "--ignore-platform-reqs"
type: string
secrets:
GH_CI_PAT:
description: 'Token password for GitHub auth'
required: true
COMPOSER_AUTH:
description: 'Auth JSON for Composer'
required: true
CODECOV_TOKEN:
description: 'Token for Codecov'
required: true
jobs:
test:
#
# ensure php standards and tests pass
#
runs-on: ubuntu-latest
strategy:
matrix:
# List of php versions to test on.
php-version: ['7.0']
steps:
# Checkout php code to test.
- name: Checkout repo
uses: actions/checkout@v3
# Setup PHP for each version in the matrix.
- name: Setup PHP
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
# Vendor PHP code.
- name: Composer
env:
COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH }}'
run: composer install -d ${{ inputs.COMPOSER_WORKING_DIRECTORY }} ${{ inputs.COMPOSER_OPTIONS }}
# Run PHP linter.
- name: php lint
if: ${{ inputs.PHP_LINT }}
run: ${{ inputs.COMPOSER_WORKING_DIRECTORY }}/vendor/bin/phpcs -s --extensions=php
# Run PHP unit tests.
- name: phpunit
if: ${{ inputs.PHP_UNIT }}
run: ${{ inputs.COMPOSER_WORKING_DIRECTORY }}/vendor/bin/phpunit --log-junit junit.xml --coverage-clover coverage.xml --testsuite ${{ inputs.PHP_UNIT_TESTSUITE }}
- name: Upload test coverage results to Codecov
if: ${{ inputs.PHP_UNIT }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ inputs.PHP_UNIT }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
#
# Create a GitHub Release based on conventional commits.
#
name: 'Release to GitHub'
runs-on: ubuntu-latest
needs: test
steps:
# Checkout code to release.
- name: Checkout repo
uses: actions/checkout@v3
# Setup Node needed to create release.
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
# Add plugin to make the changelog for the release.
- name: Add plugin for conventional commits
run: npm install conventional-changelog-conventionalcommits@6
working-directory: ./.github/workflows
# Create the release.
- name: Release to GitHub
working-directory: ./.github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GH_CI_PAT }}
GIT_AUTHOR_NAME: release-bot
GIT_AUTHOR_EMAIL: release@test.com
GIT_COMMITTER_NAME: asyncapi-bot
GIT_COMMITTER_EMAIL: info@asyncapi.io
run: npx semantic-release@22.0.12