From a2b38d3b83a520a0be37f953413fea0c603bad19 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 10 Mar 2026 15:34:53 -0500 Subject: [PATCH] Test Docker user --- .gitea/workflows/build.yml | 50 +++++++++++++++++++---------------- CMakeLists.txt | 6 ++--- docker/linux/Dockerfile | 20 ++++++++++++++ scripts/build-linux-docker.sh | 3 +++ scripts/test-linux-docker.sh | 3 +++ 5 files changed, 56 insertions(+), 26 deletions(-) create mode 100644 docker/linux/Dockerfile create mode 100755 scripts/build-linux-docker.sh create mode 100755 scripts/test-linux-docker.sh diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 743fab6..81ec0c8 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -14,30 +14,34 @@ jobs: steps: - name: Checkout repository uses: https://git.wish.moe/YourWishes/checkout@main - - name: Install dependencies - run: | - apt-get update - apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl liblua5.3-dev - - name: Run tests - run: ./scripts/test-linux.sh + - name: Install Docker + uses: https://git.wish.moe/YourWishes/setup-docker-action@releases/v4 + - name: Run tests in Docker + run: ./scripts/test-linux-docker.sh + # - name: Install dependencies + # run: | + # apt-get update + # apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl liblua5.3-dev + # - name: Run tests + # run: ./scripts/test-linux.sh - build-linux: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: https://git.wish.moe/YourWishes/checkout@main - - name: Install dependencies - run: | - apt-get update - apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl liblua5.3-dev - - name: Build Linux - run: ./scripts/build-linux.sh - - name: Upload Linux binary - uses: https://git.wish.moe/YourWishes/upload-artifact@v3/node20 - with: - name: dusk-linux - path: build-linux/Dusk - if-no-files-found: error + # build-linux: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout repository + # uses: https://git.wish.moe/YourWishes/checkout@main + # - name: Install dependencies + # run: | + # apt-get update + # apt-get install -y build-essential cmake python3 python3-pip python3-polib python3-pil libsdl2-dev libgl1-mesa-dev libzip-dev python3-dotenv python3-pyqt5 python3-opengl liblua5.3-dev + # - name: Build Linux + # run: ./scripts/build-linux.sh + # - name: Upload Linux binary + # uses: https://git.wish.moe/YourWishes/upload-artifact@v3/node20 + # with: + # name: dusk-linux + # path: build-linux/Dusk + # if-no-files-found: error # build-psp: # runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d69f62..9f57d80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -option(ENABLE_TESTS "Enable tests" OFF) +option(DUSK_BUILD_TESTS "Enable tests" OFF) # Prep cache set(DUSK_CACHE_TARGET "dusk-target") @@ -55,7 +55,7 @@ project(${DUSK_LIBRARY_TARGET_NAME} # Binary Executable add_executable(${DUSK_BINARY_TARGET_NAME} ${DUSK_SOURCES_DIR}/dusk/null.c) -if(ENABLE_TESTS) +if(DUSK_BUILD_TESTS) # MainLibrary add_library(${DUSK_LIBRARY_TARGET_NAME} STATIC) @@ -94,7 +94,7 @@ target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PUBLIC ) # Handle tests -if(ENABLE_TESTS) +if(DUSK_BUILD_TESTS) enable_testing() add_subdirectory(test) endif() diff --git a/docker/linux/Dockerfile b/docker/linux/Dockerfile new file mode 100644 index 0000000..9157d25 --- /dev/null +++ b/docker/linux/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:latest +WORKDIR /workdir +RUN apt-get update +RUN apt-get install -y \ + build-essential \ + cmake \ + python3 \ + python3-pip \ + python3-polib \ + python3-pil \ + libsdl2-dev \ + libgl1-mesa-dev \ + libzip-dev \ + python3-dotenv \ + python3-pyqt5 \ + python3-opengl \ + liblua5.3-dev \ + xz-utils \ + git +VOLUME ["/workdir"] \ No newline at end of file diff --git a/scripts/build-linux-docker.sh b/scripts/build-linux-docker.sh new file mode 100755 index 0000000..a9fc6b0 --- /dev/null +++ b/scripts/build-linux-docker.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t dusk-linux -f docker/linux/Dockerfile . +docker run --rm -v $(pwd):/workdir dusk-linux /bin/bash -c "./scripts/build-linux.sh" \ No newline at end of file diff --git a/scripts/test-linux-docker.sh b/scripts/test-linux-docker.sh new file mode 100755 index 0000000..b43a89e --- /dev/null +++ b/scripts/test-linux-docker.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker build -t dusk-linux -f docker/linux/Dockerfile . +docker run --rm -v $(pwd):/workdir dusk-linux /bin/bash -c "./scripts/test-linux.sh" \ No newline at end of file