mirror of
https://github.com/e107inc/e107.git
synced 2025-03-13 08:59:44 +01:00
84 lines
4.3 KiB
YAML
84 lines
4.3 KiB
YAML
name: Acceptance Tests
|
|
on:
|
|
push:
|
|
pull_request:
|
|
jobs:
|
|
test-acceptance:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
operating_system:
|
|
- image: docker.io/jrei/systemd-ubuntu:22.04
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install host-level tools
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y iputils-ping curl
|
|
sudo apt-get -o Dpkg::Options::="--force-overwrite" install -y podman
|
|
echo -e "export XDG_RUNTIME_DIR=/tmp/${RUNNER_TEMP}" >> $GITHUB_ENV
|
|
echo -e "export XDG_DATA_HOME=/tmp/${RUNNER_TEMP}" >> $GITHUB_ENV
|
|
echo -e "export CONTAINERS_STORAGE_CONF=/tmp/${RUNNER_TEMP}/storage.conf" >> $GITHUB_ENV
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "^1.19"
|
|
- uses: actions/checkout@v3
|
|
- name: Compile SaltStack bootstrap wrapper
|
|
run: CGO_ENABLED=0 go build -ldflags "-s -w" -o ./salt-bootstrap salt-bootstrap.go
|
|
working-directory: ./e107_tests/lib/ci/salt/
|
|
- name: Launch test container
|
|
run: |
|
|
docker run -d --rm --network host --name target -v .:/app/ ${{ matrix.operating_system.image }} tail -f /dev/null
|
|
docker exec target apt-get update && docker exec target apt-get install -y iputils-ping curl
|
|
sleep 5
|
|
if ! docker ps | grep -q target; then
|
|
docker logs target
|
|
exit 1
|
|
fi
|
|
- name: Install SaltStack
|
|
run: |
|
|
echo "Validating host network connectivity..."
|
|
ping -c 4 google.com || echo "Error: Host network connectivity issue"
|
|
echo "Checking file permissions..."
|
|
docker exec target ls -l /app/e107_tests/lib/ci/salt/ > salt_file_permissions.log || echo "Error: Failed to list file permissions"
|
|
echo "Validating internet access inside the container..."
|
|
docker exec target ping -c 4 google.com || echo "Error: Network connectivity issue inside container"
|
|
echo "Debugging SaltStack script path..."
|
|
docker exec target ls -l /app/e107_tests/lib/ci/salt/ > salt_script_path.log
|
|
if ! docker exec target test -x /app/e107_tests/lib/ci/salt/salt-bootstrap; then
|
|
echo "SaltStack script is not executable, trying to fix permissions..."
|
|
docker exec target chmod +x /app/e107_tests/lib/ci/salt/salt-bootstrap || echo "Error: Failed to set permissions for SaltStack script"
|
|
fi
|
|
echo "Fetching container logs before script execution..."
|
|
docker logs target > salt_container_logs_before.log
|
|
echo "Executing SaltStack bootstrap script..."
|
|
docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap onedir || echo "Error: SaltStack bootstrap script failed"
|
|
echo "Fetching container logs after script execution..."
|
|
docker logs target > salt_container_logs_after.log
|
|
- name: Apply Salt state
|
|
run: |
|
|
echo "Debugging file structure and permissions inside container..."
|
|
docker exec target ls -l /app/e107_tests/lib/ci/salt/ > debug_permissions.log
|
|
ln -v -s master minion
|
|
rm -fv pillars/config.sls
|
|
touch pillars/config.sls
|
|
rm -fv pillars/config-sample.sls
|
|
touch pillars/config-sample.sls
|
|
echo "Ensuring pillar files have correct permissions..."
|
|
docker exec target chmod 644 /app/e107_tests/lib/ci/salt/pillars/* || echo "Error: Could not set permissions for pillar files"
|
|
ln -v -s -f ../../config.acceptance.ci.yml pillars/config-local.sls
|
|
docker exec -w /app/e107_tests/lib/ci/salt/ target /bin/sh -c "
|
|
salt-call -c ./ --id=e107-dev --local state.apply e107-dev ||
|
|
salt-call -c ./ --id=e107-dev --local state.apply e107-dev
|
|
"
|
|
working-directory: ./e107_tests/lib/ci/salt/
|
|
- name: Install test dependencies
|
|
run: |
|
|
docker exec -w /app/e107_tests/ -e COMPOSER_ALLOW_SUPERUSER=1 target \
|
|
composer update --prefer-dist --no-progress
|
|
- name: Download Git submodule dependencies
|
|
run: git submodule update --init --recursive --remote
|
|
- name: Install the CI test configuration file
|
|
run: |
|
|
ln -v -s -f ./lib/ci/config.acceptance.ci.yml ./e107_tests/config.yml
|
|
- name: Run acceptance tests
|
|
run: docker exec -w /app/e107_tests/ target php ./vendor/bin/codecept run acceptance --steps |