-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (110 loc) · 4.05 KB
/
continuous-integration.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
# This file is part of Cookiecutter for Laravel package.
#
# Cookiecutter for Laravel package is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# Cookiecutter for Laravel package is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Cookiecutter for Laravel package. If not, see <https://www.gnu.org/licenses/>.
##
# GitHub Actions workflow that lints and tests new code before its integration
# into the master branch of the source code repository.
#
# @see {@link https://docs.github.com/en/actions} GitHub Actions
# @author Geoffrey Bernardo van Wyk <geoffrey@vanwyk.biz>
# @copyright 2024 Geoffrey Bernardo van Wyk {@link https://geoffreyvanwyk.dev}
# @license {@link http://www.gnu.org/copyleft/gpl.html} GNU GPL v3 or later
##
name: Continuous Integration
on:
pull_request:
branches:
- master
jobs:
cut-package:
name: Cut package from template
runs-on: ubuntu-22.04
steps:
- name: Checkout the source code from Git
uses: actions/checkout@v4
- name: Install Cookiecutter
run: pip install cookiecutter
- name: Install jq - commandline JSON processor
run: sudo apt install --yes jq
- name: Fill in template values
run: >
jq '.vendor_name |= "spoorsny"' cookiecutter.json |
jq '.package_name |= "laravel-potjiekos"' |
jq '.package_tite |= "Potjiekos for Laravel"' |
jq '.package_description |= "Have some potjiekos with your Laravel."' |
jq '.php_namespace |= "Spoorsny\\Laravel"' |
jq '.github_username |= "spoorsny"' |
jq '.github_repository |= "laravel-potjiekos"' |
jq '.author_name |= "John Doe"' |
jq '.author_email |= "john@example.com"' |
jq '.author_website |= "https://www.example.com"'
> values.json
&& rm cookiecutter.json
&& mv values.json cookiecutter.json
- name: Cut package from template
run: |
cd ..
cookiecutter --no-input cookiecutter-laravel-package
mv laravel-potjiekos cookiecutter-laravel-package
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: laravel-potjiekos
name: laravel-potjiekos
retention-days: 1
lint-github-actions:
name: Lint GitHub Actions workflows
needs: cut-package
runs-on: ubuntu-22.04
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: laravel-potjiekos
path: laravel-potjiekos
- name: Set up Go
uses: actions/setup-go@v4
- name: Set up linter
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest
- name: Lint workflows
run: actionlint laravel-potjiekos/.github/workflows/*.yml
test-commands:
name: Test package commands
needs: lint-github-actions
runs-on: ubuntu-22.04
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: laravel-potjiekos
path: laravel-potjiekos
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: xdebug
- name: Test commands
run: |
cd laravel-potjiekos
composer install
artisan make:model --migration Car
artisan migrate
artisan make:test --unit ExampleTest
artisan make:test --feature ExampleTest
artisan cache:clear
composer cs-fix
composer test
composer test-coverage