bunkerized-nginx/.github/workflows/test-core-linux.yml
2023-09-18 17:45:40 +02:00

65 lines
2.5 KiB
YAML

name: Core test Linux (REUSABLE)
on:
workflow_call:
inputs:
TEST:
required: true
type: string
RELEASE:
required: true
type: string
jobs:
tests:
runs-on: ubuntu-latest
steps:
# Prepare
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull BW linux ubuntu test image
run: docker pull ghcr.io/bunkerity/ubuntu-tests:${{ inputs.RELEASE }}
- name: Copy deb file to host
run: |
container_id=$(docker create "ghcr.io/bunkerity/ubuntu-tests:${{ inputs.RELEASE }}")
docker cp "$container_id:/opt/bunkerweb_dev-1_amd64.deb" "/tmp/bunkerweb.deb"
docker rm "$container_id"
- name: Install BunkerWeb
run: |
# Install NGINX
sudo apt update
sudo apt install -y curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt update
sudo apt install -y nginx=1.24.0-1~jammy
# Install BunkerWeb
echo "force-bad-version" | sudo tee -a /etc/dpkg/dpkg.cfg
sudo apt install -fy /tmp/bunkerweb.deb
- name: Edit configuration files
run: |
echo "www.example.com 127.0.0.1" | sudo tee -a /etc/hosts
sudo rm -f /etc/bunkerweb/variables.env
sudo touch /etc/bunkerweb/variables.env
echo "SERVER_NAME=www.example.com" | sudo tee -a /etc/bunkerweb/variables.env
echo "HTTP_PORT=80" | sudo tee -a /etc/bunkerweb/variables.env
echo "HTTPS_PORT=443" | sudo tee -a /etc/bunkerweb/variables.env
echo "DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4" | sudo tee -a /etc/bunkerweb/variables.env
sudo chown nginx:nginx /etc/bunkerweb/variables.env
sudo chmod 777 /etc/bunkerweb/variables.env
- name: Run tests
run: |
cd ./tests/core/${{ inputs.TEST }}
sudo ./test.sh "linux"