aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2022-01-18 08:31:14 +0800
committerGitHub <noreply@github.com>2022-01-18 08:31:14 +0800
commit05d44488bd5587786f4bd0286fc0f555c79aa46a (patch)
tree5740f396d10a9580c3a39ca536544436898ff1b6 /.github/workflows
parent08de895e8582dbc70b639ae5f511ab9ebfb4d68a (diff)
parente9475e283a82665fe6c19bebc3318b5084f15a2e (diff)
downloadpsn00bsdk-05d44488bd5587786f4bd0286fc0f555c79aa46a.tar.gz
Merge pull request #44 from spicyjpeg/actions
GitHub Actions CI, psxcd and libc fixes, new examples
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml245
1 files changed, 245 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..a72f5d3
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,245 @@
+# PSn00bSDK GitHub Actions CI script
+# (C) 2021 spicyjpeg - MPL licensed
+
+# The GCC toolchain is stored in the GitHub Actions cache after being built. To
+# minimize build times, all the toolchain build steps are skipped if there is a
+# cached copy of the toolchain that has not expired (even though the build-gcc
+# job still has to run in order to check the cache's contents). The cache is
+# shared between all actions in a repo.
+
+name: Build PSn00bSDK
+on: [ push, pull_request ]
+env:
+ BINUTILS_VERSION: 2.36
+ GCC_VERSION: 11.1.0
+ GCC_TARGET: mipsel-none-elf
+
+jobs:
+ # This is based on doc/toolchain.md, no surprises here other than the cache.
+ build-gcc:
+ name: Build GCC toolchain
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Initialize toolchain cache
+ id: _cache
+ uses: actions/cache@v2
+ with:
+ key: gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}
+ path: gcc
+
+ - name: Install prerequisites
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ sudo apt-get update -y
+ sudo apt-get install -y --no-install-recommends make g++-mingw-w64-x86-64
+
+ - name: Download and extract sources
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ wget -q -O binutils.tar.xz https://ftpmirror.gnu.org/gnu/binutils/binutils-${{ env.BINUTILS_VERSION }}.tar.xz
+ wget -q -O gcc.tar.xz https://ftpmirror.gnu.org/gnu/gcc/gcc-${{ env.GCC_VERSION }}/gcc-${{ env.GCC_VERSION }}.tar.xz
+ tar xf binutils.tar.xz
+ tar xf gcc.tar.xz
+ cd gcc-${{ env.GCC_VERSION }}
+ contrib/download_prerequisites
+
+ - name: Build binutils for Linux
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ mkdir binutils_linux
+ cd binutils_linux
+ ../binutils-${{ env.BINUTILS_VERSION }}/configure --prefix=${{ github.workspace }}/gcc/linux --target=${{ env.GCC_TARGET }} --disable-docs --disable-nls --with-float=soft
+ make -j 2
+ make install-strip
+ echo "${{ github.workspace }}/gcc/linux/bin" >>$GITHUB_PATH
+
+ - name: Build GCC for Linux
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ mkdir gcc_linux
+ cd gcc_linux
+ ../gcc-${{ env.GCC_VERSION }}/configure --prefix=${{ github.workspace }}/gcc/linux --target=${{ env.GCC_TARGET }} --disable-docs --disable-nls --disable-libada --disable-libssp --disable-libquadmath --disable-libstdc++-v3 --with-float=soft --enable-languages=c,c++ --with-gnu-as --with-gnu-ld
+ make -j 2
+ make install-strip
+
+ - name: Build binutils for Windows
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ mkdir binutils_windows
+ cd binutils_windows
+ ../binutils-${{ env.BINUTILS_VERSION }}/configure --prefix=${{ github.workspace }}/gcc/windows --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=${{ env.GCC_TARGET }} --disable-docs --disable-nls --with-float=soft
+ make -j 2
+ make install-strip
+
+ - name: Build GCC for Windows
+ if: ${{ steps._cache.outputs.cache-hit != 'true' }}
+ run: |
+ mkdir gcc_windows
+ cd gcc_windows
+ ../gcc-${{ env.GCC_VERSION }}/configure --prefix=${{ github.workspace }}/gcc/windows --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=${{ env.GCC_TARGET }} --disable-docs --disable-nls --disable-libada --disable-libssp --disable-libquadmath --disable-libstdc++-v3 --with-float=soft --enable-languages=c,c++ --with-gnu-as --with-gnu-ld
+ make -j 2
+ make install-strip
+
+ # No surprises here either. The GitHub Actions VMs even come with most of the
+ # dependencies required to build PSn00bSDK preinstalled.
+ build-sdk-windows:
+ name: Build PSn00bSDK on Windows
+ runs-on: windows-latest
+ needs: build-gcc
+
+ steps:
+ # Due to a bug in the cache action (and in order to use Ninja and pacman)
+ # the directories MSys2 stores binaries in must be added to PATH. For
+ # some reason they are not present in PATH by default.
+ # https://github.com/actions/cache/issues/576
+ - name: Add MSys2 to PATH
+ run: |
+ echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+ echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+
+ - name: Initialize toolchain cache
+ uses: actions/cache@v2
+ with:
+ key: gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}
+ path: gcc
+
+ - name: Install prerequisites
+ run: |
+ pacman -S --noconfirm mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc
+
+ - name: Fetch repo contents
+ uses: actions/checkout@v2
+ with:
+ path: sdk
+
+ - name: Update repo submodules
+ run: |
+ cd sdk
+ git submodule update --init --recursive
+
+ - name: Build and package PSn00bSDK
+ run: |
+ cmake --preset ci -S sdk -DPSN00BSDK_TC=${{ github.workspace }}\gcc\windows
+ cmake --build build
+ cmake --build build -t package
+
+ # The GitHub Actions UI doesn't allow downloading individual files from
+ # an artifact, so it's best to upload each package type as a separate
+ # artifact.
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: psn00bsdk-windows
+ path: build/packages/*.zip
+
+ - name: Upload build artifacts (NSIS)
+ uses: actions/upload-artifact@v2
+ with:
+ name: psn00bsdk-windows-nsis
+ path: build/packages/*.exe
+
+ build-sdk-linux:
+ name: Build PSn00bSDK on Linux
+ runs-on: ubuntu-latest
+ needs: build-gcc
+
+ steps:
+ - name: Initialize toolchain cache
+ uses: actions/cache@v2
+ with:
+ key: gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}
+ path: gcc
+
+ - name: Install prerequisites
+ run: |
+ sudo apt-get update -y
+ sudo apt-get install -y --no-install-recommends ninja-build
+
+ - name: Fetch repo contents
+ uses: actions/checkout@v2
+ with:
+ path: sdk
+
+ - name: Update repo submodules
+ run: |
+ cd sdk
+ git submodule update --init --recursive
+
+ - name: Build and package PSn00bSDK
+ run: |
+ cmake --preset ci -S sdk -DPSN00BSDK_TC=${{ github.workspace }}/gcc/linux
+ cmake --build build
+ cmake --build build -t package
+
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: psn00bsdk-linux
+ path: build/packages/*.zip
+
+ - name: Upload build artifacts (DEB)
+ uses: actions/upload-artifact@v2
+ with:
+ name: psn00bsdk-linux-deb
+ path: build/packages/*.deb
+
+ - name: Upload build artifacts (RPM)
+ uses: actions/upload-artifact@v2
+ with:
+ name: psn00bsdk-linux-rpm
+ path: build/packages/*.rpm
+
+ # This job takes care of creating a new release and upload the build
+ # artifacts if the last commit is associated to a tag.
+ create-release:
+ name: Create release
+ runs-on: ubuntu-latest
+ needs: [ build-sdk-windows, build-sdk-linux ]
+
+ steps:
+ - name: Initialize toolchain cache
+ if: ${{ github.ref_type == 'tag' }}
+ uses: actions/cache@v2
+ with:
+ key: gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}
+ path: gcc
+
+ - name: Package GCC toolchains
+ if: ${{ github.ref_type == 'tag' }}
+ run: |
+ cd gcc/windows
+ zip -9 -q -r ../../gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}-windows.zip .
+ cd ../linux
+ zip -9 -q -r ../../gcc-${{ env.GCC_TARGET }}-${{ env.GCC_VERSION }}-linux.zip .
+
+ - name: Fetch repo contents
+ if: ${{ github.ref_type == 'tag' }}
+ uses: actions/checkout@v2
+ with:
+ path: sdk
+
+ - name: Generate release notes
+ if: ${{ github.ref_type == 'tag' }}
+ run: |
+ python3 sdk/.github/scripts/generate_release_notes.py -v ${{ github.ref_name }} -o release.md sdk/CHANGELOG.md
+
+ - name: Fetch build artifacts
+ if: ${{ github.ref_type == 'tag' }}
+ uses: actions/download-artifact@v2
+ with:
+ path: .
+
+ - name: Publish release
+ if: ${{ github.ref_type == 'tag' }}
+ uses: softprops/action-gh-release@v1
+ with:
+ fail_on_unmatched_files: true
+ body_path: release.md
+ files: |
+ *.zip
+ psn00bsdk-windows/*
+ psn00bsdk-windows-nsis/*
+ psn00bsdk-linux/*
+ psn00bsdk-linux-deb/*
+ psn00bsdk-linux-rpm/*