-
Notifications
You must be signed in to change notification settings - Fork 12
87 lines (77 loc) · 2.67 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
name: CI/CD
on:
push:
pull_request:
env:
COMPOSER_DISABLE_XDEBUG_WARN: "1"
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: json
tools: composer
- run: composer update
- run: |
composer validate
./vendor/bin/phpcs -s .
./bin/console lint:twig ./templates
./bin/console lint:yaml ./config
./vendor/bin/minus-x check .
./bin/phpunit --exclude-group=integration
build_image:
name: Build Docker image
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build image
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: production
tags: wikimedia/copypatrol:latest
outputs: type=docker,dest=/tmp/copypatrol-production.image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Upload Docker image to artifacts
uses: actions/upload-artifact@v4
with:
name: image-production
path: /tmp/copypatrol-production.image.tar
analysis:
name: Analyze Docker images
runs-on: ubuntu-latest
needs: build_image
steps:
- name: Download Docker image from artifacts
uses: actions/download-artifact@v4
with:
name: image-production
path: /tmp
- name: Load image
run: |
docker load --input /tmp/copypatrol-production.image.tar
docker image ls -a
- name: Dive
uses: MaxymVlasov/[email protected]
with:
image: wikimedia/copypatrol:latest
github-token: ${{ secrets.GITHUB_TOKEN }}