Skip to content

Commit 0fc6e0f

Browse files
authored
ci: set up GitHub Actions for running testing workflows (#50)
1 parent 3178901 commit 0fc6e0f

8 files changed

Lines changed: 202 additions & 123 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* @Skillshare/pod-platform
2+
* @ramsey

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
version: 2
22
updates:
33
- package-ecosystem: "composer"
4+
allow:
5+
- dependency-type: all
46
directory: "/"
57
schedule:
68
interval: "monthly"
79
versioning-strategy: "increase-if-necessary"
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "monthly"

.github/workflows/continuous-integration.yml

Lines changed: 78 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22

33
name: "build"
44

5-
# Set to workflow_dispatch, so nothing automatically triggers the workflow.
6-
on: workflow_dispatch
7-
#on: ["pull_request", "push"]
5+
on:
6+
push:
7+
branches:
8+
- "main"
9+
tags:
10+
- "*"
11+
pull_request:
12+
branches:
13+
- "main"
14+
15+
# Cancels all previous workflow runs for the same branch that have not yet completed.
16+
concurrency:
17+
# The concurrency group contains the workflow name and the branch name.
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
820

921
env:
1022
COMPOSER_ROOT_VERSION: "1.99.99"
@@ -15,17 +27,17 @@ jobs:
1527
runs-on: "ubuntu-latest"
1628
steps:
1729
- name: "Checkout repository"
18-
uses: "actions/checkout@v2"
30+
uses: "actions/checkout@v3.0.1"
1931

2032
- name: "Install PHP"
21-
uses: "shivammathur/setup-php@v2"
33+
uses: "shivammathur/setup-php@2.18.1"
2234
with:
2335
php-version: "latest"
24-
extensions: "intl"
36+
extensions: "intl-70.1"
2537
coverage: "none"
2638

2739
- name: "Install dependencies (Composer)"
28-
uses: "ramsey/composer-install@v1"
40+
uses: "ramsey/composer-install@2.1.0"
2941

3042
- name: "Check syntax (php-parallel-lint)"
3143
run: "composer dev:lint:syntax"
@@ -38,75 +50,90 @@ jobs:
3850
runs-on: "ubuntu-latest"
3951
steps:
4052
- name: "Checkout repository"
41-
uses: "actions/checkout@v2"
53+
uses: "actions/checkout@v3.0.1"
4254

4355
- name: "Install PHP"
44-
uses: "shivammathur/setup-php@v2"
56+
uses: "shivammathur/setup-php@2.18.1"
4557
with:
4658
php-version: "latest"
47-
extensions: "intl"
59+
extensions: "intl-70.1"
4860
coverage: "none"
4961

5062
- name: "Install dependencies (Composer)"
51-
uses: "ramsey/composer-install@v1"
63+
uses: "ramsey/composer-install@2.1.0"
5264

5365
- name: "Statically analyze code (PHPStan)"
5466
run: "composer dev:analyze:phpstan"
5567

5668
- name: "Statically analyze code (Psalm)"
57-
run: "composer dev:analyze:psalm -- --shepherd"
58-
59-
security-analysis:
60-
name: "Security analysis"
61-
runs-on: "ubuntu-latest"
62-
steps:
63-
- name: "Checkout repository"
64-
uses: "actions/checkout@v2"
65-
66-
- name: "Install PHP"
67-
uses: "shivammathur/setup-php@v2"
68-
with:
69-
php-version: "latest"
70-
extensions: "intl"
71-
coverage: "none"
72-
73-
- name: "Install dependencies (Composer)"
74-
uses: "ramsey/composer-install@v1"
75-
76-
- name: "Analyze security of code (Psalm)"
77-
run: "./vendor/bin/psalm --taint-analysis --report=build/logs/psalm.sarif"
78-
79-
- name: "Upload security analysis results to GitHub"
80-
uses: "github/codeql-action/upload-sarif@v1"
81-
with:
82-
sarif_file: "build/logs/psalm.sarif"
69+
run: "composer dev:analyze:psalm"
70+
# NOTE: Do not report to Shepherd until the repo is public.
71+
#run: "composer dev:analyze:psalm -- --shepherd"
72+
73+
# NOTE: Repository must be public to enable security analysis on GitHub.
74+
#security-analysis:
75+
# name: "Security analysis"
76+
# needs: ["coding-standards", "static-analysis"]
77+
# runs-on: "ubuntu-latest"
78+
# steps:
79+
# - name: "Checkout repository"
80+
# uses: "actions/checkout@v3.0.1"
81+
#
82+
# - name: "Install PHP"
83+
# uses: "shivammathur/setup-php@2.18.1"
84+
# with:
85+
# php-version: "latest"
86+
# extensions: "intl-70.1"
87+
# coverage: "none"
88+
#
89+
# - name: "Install dependencies (Composer)"
90+
# uses: "ramsey/composer-install@2.1.0"
91+
#
92+
# - name: "Analyze security of code (Psalm)"
93+
# run: "./vendor/bin/psalm --taint-analysis --report=build/logs/psalm.sarif"
94+
#
95+
# - name: "Upload security analysis results to GitHub"
96+
# uses: "github/codeql-action/upload-sarif@v1"
97+
# with:
98+
# sarif_file: "build/logs/psalm.sarif"
8399

84100
code-coverage:
85101
name: "Code coverage"
102+
needs: ["coding-standards", "static-analysis"]
86103
runs-on: "ubuntu-latest"
87104
steps:
88105
- name: "Checkout repository"
89-
uses: "actions/checkout@v2"
106+
uses: "actions/checkout@v3.0.1"
90107

91108
- name: "Install PHP"
92-
uses: "shivammathur/setup-php@v2"
109+
uses: "shivammathur/setup-php@2.18.1"
93110
with:
94111
php-version: "latest"
95-
extensions: "intl"
112+
extensions: "intl-70.1"
96113
coverage: "pcov"
97114
ini-values: "memory_limit=-1"
98115

99116
- name: "Install dependencies (Composer)"
100-
uses: "ramsey/composer-install@v1"
117+
uses: "ramsey/composer-install@2.1.0"
101118

102-
- name: "Run unit tests (PHPUnit)"
119+
- name: "Run unit tests and generate coverage report (PHPUnit)"
103120
run: "composer dev:test:coverage:ci"
104121

105-
- name: "Publish coverage report to Codecov"
106-
uses: "codecov/codecov-action@v1"
122+
- name: "Publish code coverage to CodeClimate"
123+
uses: "paambaati/codeclimate-action@v3.0.0"
124+
env:
125+
CC_TEST_REPORTER_ID: "${{secrets.CC_TEST_REPORTER_ID}}"
126+
with:
127+
coverageLocations: |
128+
${{github.workspace}}/build/coverage/clover.xml:clover
129+
130+
# NOTE: Use Codecov only for public repositories.
131+
#- name: "Publish coverage report to Codecov"
132+
# uses: "codecov/codecov-action@v3.0.0"
107133

108134
unit-tests:
109135
name: "Unit tests"
136+
needs: ["code-coverage"]
110137
runs-on: "ubuntu-latest"
111138

112139
strategy:
@@ -119,20 +146,23 @@ jobs:
119146
dependencies:
120147
- "lowest"
121148
- "highest"
149+
exclude:
150+
- php-version: "8.1"
151+
dependencies: "lowest"
122152

123153
steps:
124154
- name: "Checkout repository"
125-
uses: "actions/checkout@v2"
155+
uses: "actions/checkout@v3.0.1"
126156

127157
- name: "Install PHP"
128-
uses: "shivammathur/setup-php@v2"
158+
uses: "shivammathur/setup-php@2.18.1"
129159
with:
130160
php-version: "${{ matrix.php-version }}"
131-
extensions: "intl"
161+
extensions: "intl-70.1"
132162
coverage: "none"
133163

134164
- name: "Install dependencies (Composer)"
135-
uses: "ramsey/composer-install@v1"
165+
uses: "ramsey/composer-install@2.1.0"
136166
with:
137167
dependency-versions: "${{ matrix.dependencies }}"
138168

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,10 @@
55
<h1 align="center">FormatPHP</h1>
66

77
<p align="center">
8-
<a href="https://circleci.com/gh/Skillshare/formatphp"><img src="https://circleci.com/gh/Skillshare/formatphp/tree/main.svg?style=shield&circle-token=62f660cad385d565bd7626adb947380317fc19e0" alt="circleci" /></a>
8+
<a href="https://github.com/skillshare/formatphp"><img src="https://img.shields.io/badge/source-skillshare/formatphp-blue.svg" alt="Source Code"></a>
9+
<a href="https://github.com/Skillshare/formatphp/actions/workflows/continuous-integration.yml"><img src="https://github.com/Skillshare/formatphp/actions/workflows/continuous-integration.yml/badge.svg" alt="Build Status"></a>
910
<a href="https://codeclimate.com/repos/61787bb74596dc01a300042c/maintainability"><img src="https://api.codeclimate.com/v1/badges/ea0d6112b63107b0bd40/maintainability" /></a>
1011
<a href="https://codeclimate.com/repos/61787bb74596dc01a300042c/test_coverage"><img src="https://api.codeclimate.com/v1/badges/ea0d6112b63107b0bd40/test_coverage" /></a>
11-
<!--
12-
<a href="https://github.com/skillshare/formatphp"><img src="https://img.shields.io/badge/source-skillshare/formatphp-blue.svg?style=flat-square" alt="Source Code"></a>
13-
<a href="https://packagist.org/packages/skillshare/formatphp"><img src="https://img.shields.io/packagist/v/skillshare/formatphp.svg?style=flat-square&label=release" alt="Download Package"></a>
14-
<a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/skillshare/formatphp.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a>
15-
<a href="https://github.com/skillshare/formatphp/blob/main/LICENSE"><img src="https://img.shields.io/packagist/l/skillshare/formatphp.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a>
16-
<a href="https://github.com/skillshare/formatphp/actions/workflows/continuous-integration.yml"><img src="https://img.shields.io/github/workflow/status/skillshare/formatphp/build/main?style=flat-square&logo=github" alt="Build Status"></a>
17-
<a href="https://codecov.io/gh/skillshare/formatphp"><img src="https://img.shields.io/codecov/c/gh/skillshare/formatphp?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a>
18-
<a href="https://shepherd.dev/github/skillshare/formatphp"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Fskillshare%2Fformatphp%2Fcoverage" alt="Psalm Type Coverage"></a>
19-
-->
2012
</p>
2113

2214
<p align="center">

0 commit comments

Comments
 (0)