-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (65 loc) · 2.78 KB
/
test-and-deploy.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
name: Test and Deploy
on: [ push, pull_request, workflow_dispatch ]
jobs:
build:
name: Build and Test
runs-on: self-hosted
steps:
- uses: actions/checkout@master
- name: Cache PHP dependencies
uses: actions/cache@v4
with:
path: www/vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
- name: Run Composer install
run: |
composer install --no-interaction --ignore-platform-reqs
composer require staabm/annotate-pull-request-from-checkstyle
- name : Run PHP Linter
run : |
vendor/bin/parallel-lint . --exclude vendor --checkstyle | vendor/bin/cs2pr
- name : Run PHPStan
run : |
vendor/bin/phpstan analyze --memory-limit=-1 --error-format=checkstyle | vendor/bin/cs2pr
- name : Run PHP Code Sniffer
run : |
vendor/bin/phpcs --report=checkstyle | vendor/bin/cs2pr
publish:
name: Publish
needs: build
runs-on: self-hosted
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/waterwolfdev/waterwolf-site
tags: |
type=ref,event=branch
- name: Debug Docker Metadata
run: |
echo "Tags: ${{ steps.meta.outputs.tags }}"
echo "GitHub Ref: ${{ github.ref }}"
echo "Default Branch: ${{ github.event.repository.default_branch }}"
echo "GitHub Event Name: ${{ github.event_name }}"
- name: Publish to Docker Image Repo
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/waterwolfdev/waterwolf-site:buildcache,mode=max
cache-to: type=registry,ref=ghcr.io/waterwolfdev/waterwolf-site:buildcache,mode=max