diff --git a/.github/workflows/create-app-structure.yml b/.github/workflows/create-app-structure.yml deleted file mode 100644 index 3c967ce9..00000000 --- a/.github/workflows/create-app-structure.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Create App Structure - -# Trigger the action on push or pull_request to the main branch -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - create-structure: - runs-on: ubuntu-latest - - # Explicit permissions for the workflow to write to the repository - permissions: - contents: write - actions: read - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - # Install curl and unzip to handle the HumHub package download and extraction - sudo apt-get update - sudo apt-get install -y curl unzip - - - name: Download and unzip HumHub - run: | - # Download HumHub zip file from the official site - curl -L https://download.humhub.com/downloads/install/humhub-1.17.0-beta.1.zip -o humhub.zip - - # Unzip the package into a temporary directory - unzip -q humhub.zip -d humhub_temp - - # Ensure the app/ directory exists before moving files - mkdir -p app - - # Move all contents from the extracted 'humhub-1.17.0-beta.1' directory into 'app/' - mv humhub_temp/humhub-1.17.0-beta.1/* app/ - - # Clean up by removing the temporary folder and the zip file - rm -rf humhub_temp - rm humhub.zip - - - name: Output the directory structure - run: | - # Output the structure of the 'app/' directory for confirmation - echo "App structure created successfully" - tree app/ - - - name: Commit and push changes (if any) - run: | - # Configure git user - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - # Add and commit any changes (including the unzipped HumHub content) - git add app/ - git commit -m "Unzip HumHub files directly into app/" || echo "No changes to commit" - - # Push the changes to the repository - git push origin main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..fa6a0450 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,66 @@ +name: Test Dockerfile + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Test on Ubuntu + runs-on: ubuntu-latest + + steps: + - name: Check Docker daemon + run: docker info || sudo service docker start + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.7.1 + + - name: Validate Dockerfile + id: build + run: docker build -t humhub-test -f Dockerfile . + + - name: Check Docker build status + run: docker inspect humhub-test + + - name: Start container + id: start-container + run: docker run -d --name humhub-container humhub-test + + - name: Wait for container to start + run: sleep 10 + + - name: Verify Docker image and Check PHP and Apache status + run: | + docker exec humhub-container php -v || echo "::error::PHP verification failed" + docker exec humhub-container apache2 -v || echo "::error::Apache verification failed" + + - name: Verify HumHub files + run: | + docker exec humhub-container ls /var/www/html/app || echo "::error::HumHub files verification failed" + docker exec humhub-container ls /var/www/html/app/protected/config || echo "::error::Config directory not found" + docker exec humhub-container ls /var/www/html/app/protected/modules || echo "::error::Modules directory not found" + docker exec humhub-container ls /var/www/html/app/protected || echo "::error::Protected directory not found" + + - name: Verify cron service is running + run: | + docker exec humhub-container service cron status || echo "::error::Cron service is not running" + + - name: Verify crontab contents + run: | + docker exec humhub-container cat /etc/cron.d/humhub-cron || echo "::error::Crontab is missing or not configured correctly" + + - name: Run cron jobs manually for testing + run: docker exec humhub-container cron -f & + + - name: Cleanup + run: | + docker stop humhub-container || true + docker rm humhub-container || true