Skip to content

Commit 726e6ea

Browse files
authored
Lets add a test (#2)
* Lets add a test * Fix test and README * Fix test * Not ready for 8.1 just yet * tmate * tmate * Fix job * Check test can fail * Revert "Check test can fail" This reverts commit eb40cbf.
1 parent b36cf29 commit 726e6ea

3 files changed

Lines changed: 36 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
on:
3+
pull_request:
4+
jobs:
5+
test:
6+
strategy:
7+
matrix:
8+
PHP_VERSION: [ '7.3', '7.4', '8.0']
9+
name: Test Apache action
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Create fake site
13+
run: |
14+
mkdir /tmp/sut
15+
echo '<?php' | sudo tee /tmp/sut/index.php
16+
echo ' print "<strong>Hello World</strong>";' | sudo tee -a /tmp/sut/index.php
17+
shell: bash
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.PHP_VERSION }}
22+
- uses: actions/checkout@v2
23+
- name: Setup Apache
24+
uses: ./
25+
with:
26+
php-version: ${{ matrix.PHP_VERSION }}
27+
site-directory: /tmp/sut
28+
http-port: 9090
29+
- name: Test fake site
30+
run: |
31+
curl -sSf http://127.0.0.1:9090 > /dev/null

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is a GitHub action that runs Apache with mod_php to serve a website. Use af
1111
with:
1212
php-version: '7.4'
1313
- name: Setup Apache
14-
uses: thunder/apache-shiva-php-action
14+
uses: thunder/apache-shiva-php-action@v1
1515
with:
1616
php-version: '7.4'
1717
site-directory: /path/to/code

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ runs:
3737
echo ' CustomLog ${APACHE_LOG_DIR}/access.log combined' | sudo tee -a /etc/apache2/sites-available/sut.conf
3838
echo '</VirtualHost>' | sudo tee -a /etc/apache2/sites-available/sut.conf
3939
sudo sed -ri -e "s!Listen 80!Listen ${{ inputs.http-port }}!g" /etc/apache2/ports.conf
40-
source /etc/apache2/envvars
41-
export APACHE_LOG_DIR="${PWD}"
42-
export APACHE_LOCK_DIR="${PWD}"
43-
export APACHE_PID_FILE="${PWD}/apache2.pid"
4440
sudo a2ensite sut
4541
sudo a2dissite 000-default
4642
shell: bash
4743
- name: Start Apache in the foreground
4844
run: |
45+
source /etc/apache2/envvars
46+
export APACHE_LOG_DIR="${PWD}"
47+
export APACHE_LOCK_DIR="${PWD}"
48+
export APACHE_PID_FILE="${PWD}/apache2.pid"
4949
nohup apache2 -DFOREGROUND > /dev/null 2>&1 &
5050
sleep 2
5151
nc -z "127.0.0.1" "${{ inputs.http-port }}"

0 commit comments

Comments
 (0)