From e640e2062923d6b80df8a8b39b855860ec85499d Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Wed, 20 Dec 2023 17:06:42 +0800 Subject: [PATCH 1/4] add xz package in fedora --- .github/workflows/compilation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index bb59648..974c53d 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -27,7 +27,7 @@ jobs: run: | dnf -y install @development-tools gcc gcc-c++ g++ wget git autoconf automake python3 python3-pip make cmake pkgconf \ libarchive-devel openssl-devel gpgme-devel libtool gettext texinfo bison flex gmp-devel mpfr-devel libmpc-devel ncurses-devel \ - diffutils glibc-gconv-extra + diffutils glibc-gconv-extra xz - name: Compile Tools run: | From 31ebbec99103443241dad6aa3ff0954cb20c132c Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Fri, 8 Mar 2024 21:39:03 +0100 Subject: [PATCH 2/4] Do not rely on already available package list apt and apk do manage their own package lists, but those can be outdated and require an update. This change makes it so that happens, which should prevent some failures. --- .github/workflows/compilation.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 974c53d..4525e5f 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -19,8 +19,8 @@ jobs: - name: Install dependencies Alpine if: matrix.os[0] == 'alpine' run: | - apk add build-base bash gcc git make autoconf automake python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev libtool \ - flex bison texinfo gmp-dev mpfr-dev mpc1-dev readline-dev ncurses-dev + apk add --no-cache build-base bash gcc git make autoconf automake python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev \ + libtool flex bison texinfo gmp-dev mpfr-dev mpc1-dev readline-dev ncurses-dev - name: Install dependencies Fedora if: matrix.os[0] == 'fedora' @@ -64,7 +64,8 @@ jobs: - name: Install Dependencies Ubuntu if: matrix.os[0] == 'ubuntu-latest' run: | - sudo apt-get -y install libarchive-dev libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev \ + sudo apt-get update + sudo apt-get -y install libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev \ gettext texinfo bison flex libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev echo "MSYSTEM=x64" >> $GITHUB_ENV From d52343810c495d90491305cd2f75f8ae77a18f0d Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Thu, 2 May 2024 23:22:34 +0200 Subject: [PATCH 3/4] Updating CI/CD --- .github/workflows/compilation.yml | 45 +++++++++++++++---------------- .github/workflows/docker.yml | 35 +++++++++++------------- prepare.sh | 45 +++++++++++++++++++++++++++++++ toolchain-local.sh | 11 -------- toolchain-sudo.sh | 14 ---------- 5 files changed, 83 insertions(+), 67 deletions(-) create mode 100755 prepare.sh delete mode 100755 toolchain-local.sh delete mode 100755 toolchain-sudo.sh diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index 4525e5f..4f45494 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -12,9 +12,13 @@ jobs: container: ${{ matrix.os[0] }}:${{ matrix.os[1] }} strategy: matrix: - os: [[alpine, 3.16], [fedora, latest]] + os: [ + [alpine, 3.16], + [fedora, latest], + ] + fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies Alpine if: matrix.os[0] == 'alpine' @@ -43,7 +47,7 @@ jobs: run: | tar -zcvf pspdev.tar.gz pspdev - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} path: pspdev.tar.gz @@ -53,33 +57,28 @@ jobs: runs-on: ${{ matrix.os[0] }} strategy: matrix: - os: [[macos-latest, bash], [ubuntu-latest, bash]] + os: [ + [macos-latest, arm64, bash], + [macos-13, x86_64, bash], + [ubuntu-latest, x86_64, bash], + ] + fail-fast: false defaults: run: - shell: ${{ matrix.os[1] }} {0} + shell: ${{ matrix.os[2] }} {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Install Dependencies Ubuntu - if: matrix.os[0] == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get -y install libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev \ - gettext texinfo bison flex libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev - echo "MSYSTEM=x64" >> $GITHUB_ENV - - - name: Install Dependencies Mac - if: startsWith( matrix.os[0], 'macos' ) - run: | - brew install automake libarchive bash openssl gpgme libtool gettext texinfo bison flex gnu-sed gsl gmp mpfr - echo "MSYSTEM=x64" >> $GITHUB_ENV + - name : Install dependencies on required OS + run: | + ./prepare.sh - name: Compile Tools run: | - export PATH="/usr/local/opt/libtool/libexec/gnubin:$PATH" - export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" - export PKG_CONFIG_PATH="/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig" + export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This really is only needed for macOS + export PATH="$(brew --prefix libtool)/libexec/gnubin:$PATH" # This really is only needed for macOS + export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig" #This really is only needed for macOS export PSPDEV=$PWD/pspdev export PATH=$PATH:$PSPDEV/bin ./toolchain.sh @@ -94,5 +93,5 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }} + name: pspdev-${{ steps.slug.outputs.sha8 }}-${{ matrix.os[0] }}-${{ matrix.os[1] }} path: pspdev.tar.gz diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d8f43ff..57b9c2c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,47 +14,44 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Extract DOCKER_TAG using tag name if: startsWith(github.ref, 'refs/tags/') run: | echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + - name: Use default DOCKER_TAG if: startsWith(github.ref, 'refs/tags/') != true run: | echo "DOCKER_TAG=latest" >> $GITHUB_ENV - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Github registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - - uses: docker/build-push-action@v4 + - uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} build-args: | BASE_DOCKER_ALLEGREX_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-allegrex:${{ env.DOCKER_TAG }} BASE_DOCKER_EXTRA_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-extra:${{ env.DOCKER_TAG }} - - - name: Send Compile action - run: | - export DISPATCH_ACTION="$(echo run_build)" - echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v2 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - uses: docker/build-push-action@v5 with: - repository: ${{ github.repository_owner }}/pspsdk - token: ${{ secrets.DISPATCH_TOKEN }} - event-type: ${{ env.NEW_DISPATCH_ACTION }} + push: true + tags: ${{ github.repository }}:${{ env.DOCKER_TAG }} + build-args: | + BASE_DOCKER_ALLEGREX_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-allegrex:${{ env.DOCKER_TAG }} + BASE_DOCKER_EXTRA_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-extra:${{ env.DOCKER_TAG }} diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..d670204 --- /dev/null +++ b/prepare.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +echo "Detecting OS and installing packages required for PSP Toolchain" + +#Handle macOS first +if [ "$(uname -s)" = "Darwin" ]; then + ## Check if using brew + if command -v brew &> /dev/null; then + brew update + brew install gettext texinfo bison flex gnu-sed ncurses gsl gmp mpfr autoconf automake cmake libusb-compat libarchive gpgme bash openssl libtool + brew reinstall openssl # https://github.com/Homebrew/homebrew-core/issues/169728#issuecomment-2074958306 + fi + ## Check if using MacPorts + if command -v port &> /dev/null; then + sudo port install autoconf automake cmake doxygen gsed libelf libtool pkgconfig + fi +else + + TESTOS=$(cat /etc/os-release | grep -w "ID" | cut -d '=' -f2) + + case $TESTOS in + + ubuntu | debian) + sudo apt-get update + sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev libusb-dev libreadline-dev libcurl4 libcurl4-openssl-dev libssl-dev libarchive-dev libgpgme-dev + ;; + rhel | fedora) + dnf -y install @development-tools gcc gcc-c++ g++ wget git autoconf automake python3 python3-pip make cmake pkgconf \ + libarchive-devel openssl-devel gpgme-devel libtool gettext texinfo bison flex gmp-devel mpfr-devel libmpc-devel ncurses-devel diffutils \ + libusb-compat-0.1-devel readline-devel libcurl-devel which glibc-gconv-extra xz + ;; + gentoo) + sudo emerge --noreplace net-misc/wget dev-vcs/git dev-python/pip sys-apps/fakeroot \ + app-arch/libarchive app-crypt/gpgme sys-devel/bison sys-devel/flex\ + dev-libs/mpc dev-libs/libusb-compat + ;; + arch) + sudo pacman -Sy gcc clang make cmake patch git texinfo flex bison gettext wget gsl gmp mpfr libmpc libusb readline libarchive gpgme bash openssl libtool libusb-compat boost python-pip + ;; + *) + echo "$TESTOS not supported here" + ;; + esac + +fi \ No newline at end of file diff --git a/toolchain-local.sh b/toolchain-local.sh deleted file mode 100755 index 132413a..0000000 --- a/toolchain-local.sh +++ /dev/null @@ -1,11 +0,0 @@ -export PSPDEV=$(pwd)/pspdev -export PATH=$PATH:$PSPDEV/bin - -## If specific steps were requested... -if [ $1 ]; then - ## Run the requested build scripts. - ./toolchain.sh $@ -else - ## Run the all build scripts. - ./toolchain.sh -fi diff --git a/toolchain-sudo.sh b/toolchain-sudo.sh deleted file mode 100755 index 157556f..0000000 --- a/toolchain-sudo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# toolchain-sudo.sh by Naomi Peori (naomi@peori.ca) - - INSTALLDIR=/usr/local/pspdev - - ## Enter the psptoolchain directory. - cd "`dirname $0`" || { echo "ERROR: Could not enter the psptoolchain directory."; exit 1; } - - ## Set up the environment. - export PSPDEV=$INSTALLDIR - export PATH=$PATH:$PSPDEV/bin - - ## Run the toolchain script. - ./toolchain.sh $@ || { echo "ERROR: Could not run the toolchain script."; exit 1; } From 48953c3376b640592f17e0a268c726b0f5625593 Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Sun, 12 May 2024 23:18:52 +0200 Subject: [PATCH 4/4] Do not push to dockerhub This no longer makes sense for the different layers. We only need pspdev/pspdev on there. --- .github/workflows/docker.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 57b9c2c..4f920f9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -41,17 +41,3 @@ jobs: build-args: | BASE_DOCKER_ALLEGREX_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-allegrex:${{ env.DOCKER_TAG }} BASE_DOCKER_EXTRA_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-extra:${{ env.DOCKER_TAG }} - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - uses: docker/build-push-action@v5 - with: - push: true - tags: ${{ github.repository }}:${{ env.DOCKER_TAG }} - build-args: | - BASE_DOCKER_ALLEGREX_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-allegrex:${{ env.DOCKER_TAG }} - BASE_DOCKER_EXTRA_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain-extra:${{ env.DOCKER_TAG }}