Skip to content

redirect_tests

redirect_tests #12

name: redirect_tests
on:
workflow_dispatch:
inputs:
search_path:
description: "Subpath to test, e.g. '/osw' ('/*' = all subpaths)"
default: '/*'
pull_request:
jobs:
dispatch_test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run apache docker
run: docker run -dit --name apache -e SEARCH_PATH=${{ github.event.inputs.search_path }} -v "$PWD":/usr/local/apache2/htdocs/ -v "$PWD"/.test/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf httpd:2.4
- name: Install curl
run: docker exec -i apache sh -c "apt-get update && apt-get install curl"
- name: Run tests
run: docker exec -i apache bash < .test/test.sh
pull_request_test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Get changed dirs
id: changed-dirs
uses: tj-actions/changed-files@v40
with:
dir_names: true
dir_names_max_depth: '1'
dir_names_exclude_current_dir: false
- name: List all changed dirs
run: |
paths=""
for dir in ${{ steps.changed-dirs.outputs.all_changed_files }}; do
echo "$dir was changed"
paths="$paths/$dir;"
done
echo "SEARCH_PATH=$paths" >> $GITHUB_ENV
echo "set SEARCH_PATH to $SEARCH_PATH"
- name: Run apache docker
run: docker run -dit --name apache -e SEARCH_PATH="$SEARCH_PATH" -v "$PWD":/usr/local/apache2/htdocs/ -v "$PWD"/.test/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf httpd:2.4
- name: Install curl
run: docker exec -i apache sh -c "apt-get update && apt-get install curl"
- name: Run tests
run: docker exec -i apache bash < .test/test.sh