Skip to content

Commit 7e8d776

Browse files
fix: mysql client test (#14)
* fix: mysql client test * fix: update deploy job and fix test tag issue * fix: update login task position * feat: add test action on pr open
1 parent 7370563 commit 7e8d776

File tree

3 files changed

+111
-18
lines changed

3 files changed

+111
-18
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ jobs:
2929
- name: Set up Docker Buildx
3030
uses: docker/setup-buildx-action@v3
3131

32-
- name: Login to Docker Hub
33-
uses: docker/login-action@v3
34-
with:
35-
username: ${{ secrets.DOCKER_USERNAME }}
36-
password: ${{ secrets.DOCKER_PASSWORD }}
37-
3832
- name: Build PHP Docker image
3933
uses: docker/build-push-action@v5
4034
with:
@@ -55,6 +49,12 @@ jobs:
5549
run: |
5650
container-structure-test test --image ${{ env.DOCKER_ORG_USERNAME }}/php:${{ matrix.php_version }} --config php-structure-test.yaml
5751
52+
- name: Login to Docker Hub
53+
uses: docker/login-action@v3
54+
with:
55+
username: ${{ secrets.DOCKER_USERNAME }}
56+
password: ${{ secrets.DOCKER_PASSWORD }}
57+
5858
- name: Push PHP Docker image
5959
if: success()
6060
uses: docker/build-push-action@v5
@@ -89,19 +89,13 @@ jobs:
8989
- name: Set up Docker Buildx
9090
uses: docker/setup-buildx-action@v3
9191

92-
- name: Login to Docker Hub
93-
uses: docker/login-action@v3
94-
with:
95-
username: ${{ secrets.DOCKER_USERNAME }}
96-
password: ${{ secrets.DOCKER_PASSWORD }}
97-
9892
- name: Build OpenLiteSpeed Docker image
9993
uses: docker/build-push-action@v5
10094
with:
10195
file: openlitespeed/Dockerfile
10296
context: openlitespeed
10397
load: true
104-
tags: ${{ env.DOCKER_ORG_USERNAME }}/php:${{ matrix.php_version }}
98+
tags: ${{ env.DOCKER_ORG_USERNAME }}/openlitespeed:${{ matrix.php_version }}
10599
build-args: |
106100
PHP_VERSION=${{ matrix.php_version }}
107101
LSPHP=${{ matrix.lsphp }}
@@ -114,7 +108,13 @@ jobs:
114108
115109
- name: Run Container Structure Tests
116110
run: |
117-
container-structure-test test --image ${{ env.DOCKER_ORG_USERNAME }}/php:${{ matrix.php_version }} --config ols-structure-test.yaml
111+
container-structure-test test --image ${{ env.DOCKER_ORG_USERNAME }}/openlitespeed:${{ matrix.php_version }} --config ols-structure-test.yaml
112+
113+
- name: Login to Docker Hub
114+
uses: docker/login-action@v3
115+
with:
116+
username: ${{ secrets.DOCKER_USERNAME }}
117+
password: ${{ secrets.DOCKER_PASSWORD }}
118118

119119
- name: Push OpenLiteSpeed Docker image
120120
if: success()

.github/workflows/test.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Run tests on Docker images
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
env:
10+
DOCKER_ORG_USERNAME: ${{ vars.DOCKER_ORG_USERNAME || 'meghsh' }}
11+
12+
jobs:
13+
build-php:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
php_version: ["7.4", "8.0", "8.1", "8.2", "8.3"]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Build PHP Docker image
29+
uses: docker/build-push-action@v5
30+
with:
31+
file: php/Dockerfile
32+
context: php
33+
load: true
34+
tags: ${{ env.DOCKER_ORG_USERNAME }}/php:${{ matrix.php_version }}
35+
build-args: |
36+
PHP_VERSION=${{ matrix.php_version }}
37+
38+
- name: Install Container Structure Test
39+
run: |
40+
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
41+
chmod +x container-structure-test-linux-amd64
42+
sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
43+
44+
- name: Run Container Structure Tests
45+
run: |
46+
container-structure-test test --image ${{ env.DOCKER_ORG_USERNAME }}/php:${{ matrix.php_version }} --config php-structure-test.yaml
47+
48+
build-openlitespeed:
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
include:
53+
- php_version: "7.4"
54+
lsphp: "lsphp74"
55+
- php_version: "8.1"
56+
lsphp: "lsphp81"
57+
- php_version: "8.2"
58+
lsphp: "lsphp82"
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Build OpenLiteSpeed Docker image
70+
uses: docker/build-push-action@v5
71+
with:
72+
file: openlitespeed/Dockerfile
73+
context: openlitespeed
74+
load: true
75+
tags: ${{ env.DOCKER_ORG_USERNAME }}/openlitespeed:${{ matrix.php_version }}
76+
build-args: |
77+
PHP_VERSION=${{ matrix.php_version }}
78+
LSPHP=${{ matrix.lsphp }}
79+
80+
- name: Install Container Structure Test
81+
run: |
82+
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
83+
chmod +x container-structure-test-linux-amd64
84+
sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
85+
86+
- name: Run Container Structure Tests
87+
run: |
88+
container-structure-test test --image ${{ env.DOCKER_ORG_USERNAME }}/openlitespeed:${{ matrix.php_version }} --config ols-structure-test.yaml

php-structure-test.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ commandTests:
8585
args: ["--version"]
8686
expectedOutput: ["git version"]
8787

88-
- name: "MySQL client is installed"
89-
command: "mysql"
88+
# - name: "MySQL client is installed"
89+
# command: "bash"
90+
# args: ["-c", "mysql --version 2>/dev/null"]
91+
# expectedOutput: ["mysql from", "client"]
92+
93+
- name: "MariaDB client is installed"
94+
command: "mariadb"
9095
args: ["--version"]
91-
expectedOutput: ["mysql Ver"]
96+
expectedOutput: ["mariadb"]
9297

9398
- name: "Unzip is installed"
9499
command: "unzip"
@@ -98,4 +103,4 @@ commandTests:
98103
- name: "ImageMagick is installed"
99104
command: "convert"
100105
args: ["-version"]
101-
expectedOutput: ["ImageMagick"]
106+
expectedOutput: ["ImageMagick"]

0 commit comments

Comments
 (0)