PHP Web Framework Laravel Gitea Actions

Laravel CI/CD Made Easy
Laravel CI/CD Made Easy

Live stream set for 2025-09-23 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

Getting Started with Gitea Actions for Laravel CI/CD Using Podman and MariaDB

If you are a developer looking for a simple, open-source way to automate testing and deployment of your Laravel applications, Gitea Actions combined with Podman and MariaDB might be just the right solution for you.

In this post, I will walk you through the steps to set up a continuous integration and deployment (CI/CD) workflow for a Laravel app using Gitea Actions that runs tests inside Podman containers connected to a MariaDB database.

What is Gitea and Gitea Actions?

Gitea is a lightweight, self-hosted Git service that is fully open source. It is similar to GitHub but designed to be simple and easy to run on your own server. Gitea Actions is a built-in automation feature that lets you run workflows like tests and deployments triggered by Git events.

Why Use Podman Instead of Docker?

Podman is a container engine compatible with Docker images but runs without a root daemon. This makes it safer and easier to use on Linux distributions like Fedora. Podman can be used with podman-compose, which is similar to Docker Compose, to manage multi-container applications like Laravel plus MariaDB.

Overview of the Setup

This setup includes the following components:

  • Your Laravel application code hosted in Gitea
  • A podman-compose file defining Laravel app and MariaDB containers
  • A shell script to start containers, run Laravel tests, and stop containers
  • A Gitea Actions workflow that triggers the shell script on every push

Step 1 – Repository Folder Structure

Your Laravel project repository should include the following files and folders for CI/CD:


laravel-app/
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
├── routes/
├── tests/
├── .ci/
│   └── run-tests.sh
├── .gitea/
│   └── workflows/
│       └── ci.yml
├── podman-compose.yml
├── artisan
├── composer.json
└── ...

The key additions are the .ci/run-tests.sh script, the .gitea/workflows/ci.yml workflow file, and the podman-compose.yml file.

Step 2 – Create the Podman Compose File

Create podman-compose.yml at the root of your repo to define Laravel and MariaDB containers:

version: '3.8'

services:
  app:
    image: php:8.4-fpm
    container_name: laravel-app
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html
    ports:
      - "9000:9000"
    depends_on:
      - db
    command: bash -c "composer install && php artisan migrate && php-fpm"

  db:
    image: mariadb:10.11
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: laravel
      MYSQL_USER: laraveluser
      MYSQL_PASSWORD: secret
    ports:
      - "3306:3306"
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata:

This file will spin up a PHP-FPM container with your Laravel app and a MariaDB database container.

Step 3 – Write the Test Runner Script

Create .ci/run-tests.sh with the following content:

#!/bin/bash
set -e

echo 'Stopping any existing containers...'
podman-compose -f podman-compose.yml down || true

echo 'Starting containers and running tests...'
podman-compose -f podman-compose.yml up --build -d

# Wait for database to be ready
echo 'Waiting for MariaDB to start...'
sleep 20

echo 'Running Laravel tests...'
podman exec laravel-app php artisan test

TEST_RESULT=$?

echo 'Stopping containers...'
podman-compose -f podman-compose.yml down

exit $TEST_RESULT

Make the script executable:

chmod +x .ci/run-tests.sh

Step 4 – Configure Gitea Actions Workflow

Create .gitea/workflows/ci.yml to define the workflow triggered on every push to the main branch:

name: Laravel Podman CI

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Make test script executable
        run: chmod +x .ci/run-tests.sh

      - name: Run Laravel tests using Podman
        run: .ci/run-tests.sh

This workflow checks out your code, makes your test script executable, and runs it. The test script manages Podman containers and Laravel tests.

Step 5 – Register and Run Gitea Actions Runner

To run Gitea Actions workflows, you need to set up a runner (such as act_runner) on a Fedora 42 machine where Podman is installed. The runner will pick up workflow jobs and execute your scripts.

Make sure Podman and podman-compose are installed on the runner machine, and your runner user has permissions to run Podman commands.

Summary

With this setup, every push to your Gitea repository triggers the Gitea Actions workflow, which runs your custom shell script. The script spins up Laravel and MariaDB containers inside Podman, runs your Laravel tests, then stops the containers. This creates a secure, open-source CI/CD pipeline without relying on Docker.

Screenshots And Screencast

Laravel Installation
Command Line Displaying Laravel Core Installation

Laravel Git Installation
Command Line Displaying Laravel Git Setup

Database Config
Gnome Text Editor Displaying App Database Configuration File

Runner Script
Gnome Text Editor Displaying Runner Script

Gitea Actions
Gnome Text Editor Displaying Gitea Actions

Git Pull Request
Command Line Git Push Generating A Pull Request

Gitea Showing New Push
Web Browser Displaying New Push Notification

Gitea Showing Updated Repo
Web Browser Displaying Latest Repo Changes

Gitea Workflow Actions
Web Browser Displaying Gitea Workflows For Repository

Laravel Project Using Gitea Actions

Learn More and Get Support

I am Edward Ojambo, a software developer passionate about teaching others how to build and automate modern web applications.

Conclusion

Using Gitea Actions with Podman and MariaDB is a powerful, open-source way to manage continuous integration and deployment for your Laravel projects. It is flexible, secure, and designed to fit well into a Fedora or Podman-based environment.

If you are ready to take your Laravel app automation to the next level, this setup is a fantastic starting point.

If you want help generating full configuration files or scripts, just let me know.

Recommended Resources:

Disclosure: Some of the links above are referral (affiliate) links. I may earn a commission if you purchase through them - at no extra cost to you.

About Edward

Edward is a software engineer, web developer, and author dedicated to helping people achieve their personal and professional goals through actionable advice and real-world tools.

As the author of impactful books including Learning JavaScript, Learning Python, Learning PHP, Mastering Blender Python API, and fiction The Algorithmic Serpent, Edward writes with a focus on personal growth, entrepreneurship, and practical success strategies. His work is designed to guide, motivate, and empower.

In addition to writing, Edward offers professional "full-stack development," "database design," "1-on-1 tutoring," "consulting sessions,", tailored to help you take the next step. Whether you are launching a business, developing a brand, or leveling up your mindset, Edward will be there to support you.

Edward also offers online courses designed to deepen your learning and accelerate your progress. Explore the programming on languages like JavaScript, Python and PHP to find the perfect fit for your journey.

📚 Explore His Books – Visit the Book Shop to grab your copies today.
💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.
🎓 Ready to Learn? – Check out his Online Courses to turn your ideas into results.

Leave a Reply

Your email address will not be published. Required fields are marked *