Skip to content

Commit

Permalink
Add gha to check for kos compile errors
Browse files Browse the repository at this point in the history
Make adjustments to Dockerfile and pr-docs-check.yml
  • Loading branch information
andressbarajas committed Dec 4, 2024
1 parent 28496b0 commit df2fe69
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gen-toolchains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- utils/dc-chain/Makefile
- utils/dc-chain/Makefile.default.cfg
- utils/dc-chain/docker/Dockerfile
- kernel/arch/dreamcast/kernel/startup.s

permissions:
packages: write
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pr-docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name: Doxygen Check on PRs

on:
pull_request: # Triggers on all pull requests, regardless of the target branch
pull_request:
branches:
- master
paths:
- 'include/**'
- 'kernel/arch/dreamcast/include/**'
Expand All @@ -28,7 +30,7 @@ jobs:
with:
path: ./doxygen-1.11.0
key: doxygen-1.11.0-${{ runner.os }}

- name: Install Doxygen 1.11.0
run: |
if [ ! -f doxygen-1.11.0/bin/doxygen ]; then
Expand All @@ -46,7 +48,7 @@ jobs:
# Count the warnings and store the count in a variable
warning_count=$(grep -c "warning:" doxygen_output.log)
# Extract only warnings and display them if any are found
if [ "$warning_count" -gt 1 ]; then
echo "Doxygen generated warnings:"
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/pr-kos-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: KOS Check on PRs

on:
pull_request:
branches:
- master
paths:
- 'include/**'
- 'kernel/**'
- 'addons/**'
- 'utils/**'

jobs:
build-and-test:
runs-on: ubuntu-latest

strategy:
matrix:
toolchain:
- "13.3-legacy"
- "14.2-stable"
- "15.0-dev"

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Convert Repository Owner to Lowercase
id: lower-owner
run: |
echo "repository_owner=${GITHUB_REPOSITORY%%/*}" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
- name: Pull Toolchain Image
run: |
docker pull ghcr.io/${{ steps.lower-owner.outputs.repository_owner }}/dc-toolchain:${{ matrix.toolchain }}
- name: Build SDK
run: |
docker run --rm \
-v ${{ github.workspace }}:/opt/toolchains/dc/kos \
-w /opt/toolchains/dc/kos \
ghcr.io/${{ steps.lower-owner.outputs.repository_owner }}/dc-toolchain:${{ matrix.toolchain }} \
"source environ.sh.master && make all V=1 | tee build.log"
- name: Upload Build Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.toolchain }}-pr-${{ github.event.pull_request.number }}-${{ github.run_id }}
path: build.log

40 changes: 24 additions & 16 deletions utils/dc-chain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LABEL maintainer="KallistiOS (Unchained)"
# Installing bare minimum for toolchain compilation
RUN apk add --no-cache \
build-base \
coreutils \
gmp-dev \
mpfr-dev \
mpc1-dev \
Expand Down Expand Up @@ -45,10 +46,18 @@ ARG default_precision=m4-single-only
ARG thread_model=kos
ARG use_kos_patches=1

RUN mkdir -p /opt/toolchains/dc \
&& git clone --depth=1 https://github.com/KallistiOSUnchained/KallistiOS.git /opt/toolchains/dc/kos \
&& cd /opt/toolchains/dc/kos/utils/dc-chain \
&& make build \
ARG KOS_REPO_URL="https://github.com/KallistiOSUnchained/KallistiOS.git"
ARG KOS_REPO_BRANCH="master"

# Pull repo
RUN mkdir -p /opt/toolchains/dc && \
git clone --depth=1 --branch ${KOS_REPO_BRANCH} ${KOS_REPO_URL} /opt/toolchains/dc/kos

# Set working directory to the dc-chain directory for GCC builds
WORKDIR /opt/toolchains/dc/kos/utils/dc-chain

# Build SH4 GCC Compiler
RUN make build \
toolchain_profile=$dc_chain \
makejobs=$makejobs \
verbose=$verbose \
Expand All @@ -62,8 +71,15 @@ RUN mkdir -p /opt/toolchains/dc \
precision_modes=$precision_modes \
default_precision=$default_precision \
thread_model=$thread_model \
use_kos_patches=$use_kos_patches \
&& rm -rf /opt/toolchains/dc/kos
use_kos_patches=$use_kos_patches

# Build ARM GCC Compiler
RUN make build-arm \
makejobs=$makejobs \
verbose=$verbose

# Remove kos directory, gcc binaries are in dc directory
RUN rm -rf /opt/toolchains/dc/kos

# Stage 2: Minimal Runtime Environment
FROM alpine:latest
Expand All @@ -77,6 +93,7 @@ RUN mkdir -p /opt/toolchains/dc/bin
# Installing prerequisites for compiling KOS, kos-ports, utils
RUN apk add --no-cache \
build-base \
coreutils \
cmake \
git \
curl \
Expand All @@ -88,20 +105,11 @@ RUN apk add --no-cache \
python3 \
ruby-rake \
libisofs-dev \
meson \
coreutils
meson

# Set default working directory
WORKDIR /opt/toolchains/dc

# Set BASH_ENV so it works for non interactive as well
# example: docker run --rm $TAG "make"
ENV BASH_ENV="/opt/toolchains/dc/kos/environ.sh.master"

# Set Shell to Bash so environ.sh.master will be sourced
# in every following run command
SHELL ["/bin/bash", "-c"]

# Set entry point to bash so arg to docker run can be
# run as a command.
ENTRYPOINT ["/bin/bash", "-c"]
Expand Down

0 comments on commit df2fe69

Please sign in to comment.