Skip to content

Commit 4107d53

Browse files
committed
Publish
0 parents  commit 4107d53

File tree

5 files changed

+198
-0
lines changed

5 files changed

+198
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Ring Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Login to Quay.io
20+
uses: docker/login-action@v3
21+
with:
22+
registry: quay.io
23+
username: ${{ secrets.QUAY_USERNAME }}
24+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
25+
- name: Build and push
26+
uses: docker/build-push-action@v6
27+
with:
28+
context: .
29+
file: Dockerfile
30+
platforms: linux/amd64
31+
push: true
32+
tags: quay.io/ydrag0n/ring:latest,quay.io/ydrag0n/ring:${{ github.ref_name }}
33+
outputs: type=image,name=target

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Use Ubuntu 24.04 (noble) as the base image
2+
FROM ubuntu:noble
3+
4+
# Set environment variables to reduce interaction during package installation
5+
ENV DEBIAN_FRONTEND=noninteractive \
6+
LANG=C.UTF-8 \
7+
LC_ALL=C.UTF-8
8+
9+
# Install necessary packages
10+
RUN apt-get update && apt-get install -y -qq --no-install-recommends \
11+
build-essential \
12+
ca-certificates \
13+
git \
14+
unixodbc \
15+
unixodbc-dev \
16+
libmysqlclient-dev \
17+
libpq-dev \
18+
libcurl4-gnutls-dev \
19+
libssl-dev \
20+
liballegro5-dev \
21+
liballegro-image5-dev \
22+
liballegro-ttf5-dev \
23+
liballegro-audio5-dev \
24+
liballegro-acodec5-dev \
25+
liballegro-dialog5-dev \
26+
liballegro-physfs5-dev \
27+
qtbase5-dev \
28+
qtchooser \
29+
qt5-qmake \
30+
qtbase5-dev-tools \
31+
qtmultimedia5-dev \
32+
libqt5multimedia5-plugins \
33+
libqt5webkit5-dev \
34+
libqt5serialport5-dev \
35+
qtconnectivity5-dev \
36+
qtdeclarative5-dev \
37+
libqt5opengl5-dev \
38+
libqt5texttospeech5-dev \
39+
qtpositioning5-dev \
40+
qt3d5-dev \
41+
qt3d5-dev-tools \
42+
libqt5charts5-dev \
43+
libqt5svg5-dev \
44+
qtwebengine5-dev \
45+
qml-module-qtquick-controls \
46+
qml-module-qtcharts \
47+
mesa-common-dev \
48+
freeglut3-dev \
49+
libpng-dev \
50+
libsdl2-dev \
51+
libsdl2-net-dev \
52+
libsdl2-mixer-dev \
53+
libsdl2-image-dev \
54+
libsdl2-ttf-dev \
55+
apache2 \
56+
libuv1-dev \
57+
&& apt-get clean \
58+
&& rm -rf /var/lib/apt/lists/* \
59+
&& rm -rf /var/cache/apt/*
60+
61+
# Create /opt/ring directory
62+
RUN mkdir -p /opt/ring
63+
64+
# Clone and build Ring
65+
WORKDIR /opt/ring
66+
RUN git clone --depth 1 --branch v1.21.2 https://github.com/ring-lang/ring . \
67+
&& find . -type f -name "*.sh" -exec sed -i 's/\bsudo\b//g' {} + \
68+
&& cd build \
69+
&& bash buildgcc.sh
70+
71+
# Copy the entrypoint script
72+
COPY entrypoint.sh /entrypoint.sh
73+
RUN chmod +x /entrypoint.sh
74+
75+
# Set the working directory
76+
WORKDIR /app
77+
78+
# Set the entrypoint
79+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Ring Action
2+
3+
An experimental GitHub Action that compiles a Ring project.
4+
5+
## Inputs
6+
7+
### `file` (required)
8+
- **Description**: The path to the Ring file to build.
9+
10+
### `args` (optional)
11+
- **Description**: Additional arguments to pass to Ring2EXE.
12+
13+
### `version` (optional)
14+
- **Description**: Specifies the version of the Ring compiler to use. This can be any valid reference for `git checkout`, such as a commit hash, tag, or branch.
15+
- **Default**: `v1.21.2` *(Latest release)*
16+
17+
## Example Usage
18+
19+
Here’s an example of how to use this action in your workflow:
20+
21+
```yaml
22+
uses: ysdragon/ring-action@v1
23+
with:
24+
file: "program.ring"
25+
```

action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Build Ring Project'
2+
description: 'A GitHub Action for building Ring projects within a Docker container.'
3+
author: 'ysdragon'
4+
inputs:
5+
args:
6+
description: 'Optional command line flags for the Ring compiler. Use "-static" for static builds for example.'
7+
required: false
8+
default: ''
9+
file:
10+
description: 'The Ring file to compile.'
11+
required: true
12+
version:
13+
description: 'Specify the version of the Ring compiler to use (commit ID, tag, branch, or hash).'
14+
required: false
15+
default: 'v1.21.2'
16+
branding:
17+
color: 'blue'
18+
icon: 'package'
19+
runs:
20+
using: 'docker'
21+
image: 'docker://quay.io/ydrag0n/ring:latest'

entrypoint.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Exit on error, print commands being executed
4+
set -ex
5+
6+
# Check if we need to switch Ring versions
7+
if [ "$INPUT_VERSION" != "v1.21.2" ]; then
8+
# Navigate to the ring directory
9+
pushd /opt/ring
10+
11+
# Clean untracked files and directories
12+
git clean -xf
13+
14+
# Fetch all remote branches and tags
15+
git fetch --all --tags
16+
17+
# Reset origin/master
18+
git reset --hard origin/master
19+
20+
# If INPUT_VERSION is a tag, checkout the tag
21+
if git rev-parse "refs/tags/$INPUT_VERSION" >/dev/null 2>&1; then
22+
git checkout "refs/tags/$INPUT_VERSION"
23+
# If INPUT_VERSION is a branch, checkout the remote branch
24+
elif git rev-parse "origin/$INPUT_VERSION" >/dev/null 2>&1; then
25+
git checkout -B "$INPUT_VERSION" "origin/$INPUT_VERSION"
26+
else
27+
echo "Error: Version $INPUT_VERSION not found"
28+
exit 1
29+
fi
30+
31+
# Build the project
32+
cd build
33+
bash buildgcc.sh
34+
35+
# Return to the previous directory
36+
popd
37+
fi
38+
39+
# Execute ring2exe with the provided arguments and input file
40+
ring2exe $INPUT_ARGS $INPUT_FILE

0 commit comments

Comments
 (0)