-
-
Notifications
You must be signed in to change notification settings - Fork 17
129 lines (123 loc) · 4.31 KB
/
build-php-images.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
name: Build PHP Images
on:
# Uncomment below for testing purposes
pull_request:
push:
branches:
- main
jobs:
buildx:
runs-on: ubuntu-22.04
env:
TERM: xterm
strategy:
fail-fast: false
matrix:
lando-version:
- 3-dev
include:
- image: php
tag: 8.2-fpm-4
context: images/8.2-fpm
- image: php
tag: 8.2-apache-4
context: images/8.2-apache
- image: php
tag: 8.1-fpm-4
context: images/8.1-fpm
- image: php
tag: 8.1-apache-4
context: images/8.1-apache
- image: php
tag: 8.0-fpm-4
context: images/8.0-fpm
- image: php
tag: 8.0-apache-4
context: images/8.0-apache
- image: php
tag: 7.4-fpm-4
context: images/7.4-fpm
- image: php
tag: 7.4-apache-4
context: images/7.4-apache
- image: php
tag: 7.3-fpm-4
context: images/7.3-fpm
- image: php
tag: 7.3-apache-4
context: images/7.3-apache
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
# Sets our edge tag if on PR.
- name: Set tag suffix
id: pr
if: ${{ github.event_name == 'pull_request' }}
run: echo "tag-suffix=-edge" >> $GITHUB_OUTPUT
# Build our images.
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }}
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
platforms: linux/amd64,linux/arm64
push: true
tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Handle Lando Install to test the images after build
# We are hardcoding the dtaa normally included in the matrix
# due to how this testing is setup
- name: Install node 16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
- name: Setup lando ${{ matrix.lando-version }}
uses: lando/setup-lando@v2
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/php=/home/runner/work/php/php
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep php | grep /home/runner/work/php/php || (echo "::error:: Not dogfooding this plugin correctly! " && exit 1)
# This block should eventually become use lando/actions-leia@v2
# @NOTE? Do we want a way for our leia-action to configure apparmor since
# this might break a whole bunch of tests? or is this literally just a thing
# for the Lagoon mysql/mariadb container?
- name: Configure apparmor
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
# Test newly built images.
- name: Test Edge Images on PR
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
yarn leia "./examples/images-edge/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash
- name: Test Stable Images on Push
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
yarn leia "./examples/images-stable/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash