Skip to content

Commit

Permalink
Working docker container for testing and building
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAwesome committed Nov 27, 2024
1 parent 27bf8b9 commit f74646c
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build_godot_gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: GUI Debug Build/Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Logging overhaul:
Prerequisites:
[] flatpak

[] cargo update
[] can TrickID be &'static? it seems like they will always be? we have no need to ever construct a new one at runtime, they always come from outside, right?
[] implement general updates!
[] make cargo test in base repo run tests in GUI as well (and vice-versa?)
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cargo build --release

pushd gui/godot/
rm build/*
godot --headless --export-debug "Linux"
godot --headless --export-release "Linux"
cp build/* "$BUILDDIR"
popd

Expand Down
2 changes: 1 addition & 1 deletion gui/godot/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name="Linux"
platform="Linux"
runnable=true
advanced_options=false
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
Expand Down
59 changes: 59 additions & 0 deletions misc/act-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM archlinux:base-devel
ENV CI true
RUN pacman -Syu --noconfirm git flatpak fontconfig p7zip
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN ln -sf /root/.cargo/bin/cargo /usr/bin/cargo

# {{{
# NOTE: these are copied in like this instead of downloaded from elsewhere
# because we need 4.4 to stop a terrible Linux bug in Godot,
# and download times from tuxfamily are quite slow.
# TODO: Switch to fetching from github once 4.4 is officially released
RUN mkdir -p /root/.local/share/godot/export_templates/4.4.dev3/
RUN mkdir -p /tmp/godot_extraction
COPY godot_binary.7z linux_debug.7z linux_release.7z /tmp/godot_extraction/
WORKDIR /tmp/godot_extraction
RUN 7z x godot_binary.7z
RUN 7z x linux_debug.7z
RUN 7z x linux_release.7z
RUN cp Godot_v4.4-dev3_linux.x86_64 /usr/bin/godot
WORKDIR /root/.local/share/godot/export_templates/4.4.dev3/
RUN cp /tmp/godot_extraction/linux_debug.4.4.dev3.x86_64 linux_debug.x86_64
RUN cp /tmp/godot_extraction/linux_release.4.4.dev3.x86_64 linux_release.x86_64
WORKDIR /
RUN rm -r /tmp/godot_extraction
# }}}

RUN mkdir -p /work
WORKDIR /work
#RUN apt-get -y install git
# Seed cargo cache

# Install a tiny package (and all of flatpak's ridiculous dependencies)
# Otherwise, flatpak list will fail
RUN flatpak list

RUN git clone https://github.com/MrAwesome/decktricks.git
#RUN apt-get -y install gcc pkg-config libssl-dev
WORKDIR /work/decktricks
RUN cargo build
RUN cargo build --release
RUN cargo test
RUN cargo test --release
WORKDIR /work/decktricks/gui/rust
RUN cargo build
RUN cargo build --release
RUN cargo test
RUN cargo test --release

# Everything below this is just to make sure that we're putting out a working image
WORKDIR /work/decktricks/gui/godot
# Deps used by decktricks/godot:
RUN mkdir -p build
RUN godot --headless --verbose --export-debug Linux
RUN cp /work/decktricks/gui/rust/target/debug/libdecktricks_godot_gui.so build/
WORKDIR /work/decktricks
RUN ./scripts/tests/test_gui_simple_e2e.sh

# Don't forget to run `docker container prune` followed by `docker image prune`
# to reclaim disk space if you've been testing here!
Binary file added misc/act-docker/godot_binary.7z
Binary file not shown.
Binary file added misc/act-docker/linux_debug.7z
Binary file not shown.
Binary file added misc/act-docker/linux_release.7z
Binary file not shown.
9 changes: 9 additions & 0 deletions scripts/build_local_docker_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -euxo pipefail

# To avoid needing sudo to run docker commands, run this and then log out and back in:
# sudo usermod -aG docker $USER

cd "$(dirname "$0")"/../misc/act-docker
docker build -t decktricks-act .

0 comments on commit f74646c

Please sign in to comment.