From df2fe69d79d6b5054c836ca725a7d0c16561e618 Mon Sep 17 00:00:00 2001 From: Andress Barajas Date: Tue, 3 Dec 2024 18:45:09 -0800 Subject: [PATCH] Add gha to check for kos compile errors Make adjustments to Dockerfile and pr-docs-check.yml --- .github/workflows/gen-toolchains.yaml | 1 + .github/workflows/pr-docs-check.yml | 8 ++-- .github/workflows/pr-kos-check.yaml | 58 +++++++++++++++++++++++++++ utils/dc-chain/docker/Dockerfile | 40 ++++++++++-------- 4 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/pr-kos-check.yaml diff --git a/.github/workflows/gen-toolchains.yaml b/.github/workflows/gen-toolchains.yaml index b0772f98e..6e2985fbb 100644 --- a/.github/workflows/gen-toolchains.yaml +++ b/.github/workflows/gen-toolchains.yaml @@ -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 diff --git a/.github/workflows/pr-docs-check.yml b/.github/workflows/pr-docs-check.yml index b0ba532d2..9cbebc2e9 100644 --- a/.github/workflows/pr-docs-check.yml +++ b/.github/workflows/pr-docs-check.yml @@ -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/**' @@ -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 @@ -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:" diff --git a/.github/workflows/pr-kos-check.yaml b/.github/workflows/pr-kos-check.yaml new file mode 100644 index 000000000..84dda4ea1 --- /dev/null +++ b/.github/workflows/pr-kos-check.yaml @@ -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 + diff --git a/utils/dc-chain/docker/Dockerfile b/utils/dc-chain/docker/Dockerfile index b20aff769..384af683d 100644 --- a/utils/dc-chain/docker/Dockerfile +++ b/utils/dc-chain/docker/Dockerfile @@ -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 \ @@ -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 \ @@ -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 @@ -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 \ @@ -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"]