diff options
| author | coco875 <59367621+coco875@users.noreply.github.com> | 2025-12-08 16:49:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 08:49:21 -0700 |
| commit | 5b79a1c9106bd1d327d624362620cba1fe4cc674 (patch) | |
| tree | 3bc089a2af7a56c4de11e42ef10318e828c2fa14 /.github | |
| parent | b2479390ba7d0facf9bafcfe862d29ff03798671 (diff) | |
Improve cmake, make release need less dependancy and clean up some file (#584)
* Update CMakeLists.txt
* try something to use less dependancy
* improve script
* Delete addr_to_sym.py
* restore dockerfile
* move the docker for release and a script to execute it to script
* Delete build.sh
* move more script to script folder
* add the new docker in the CI
* Update vcpkg.json
* fix windows and macos in theory
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/linux-compile.yml | 81 | ||||
| -rw-r--r-- | .github/workflows/main.yml | 95 |
2 files changed, 163 insertions, 13 deletions
diff --git a/.github/workflows/linux-compile.yml b/.github/workflows/linux-compile.yml index 7f0fe1a5f..cbf6fbb2c 100644 --- a/.github/workflows/linux-compile.yml +++ b/.github/workflows/linux-compile.yml @@ -54,3 +54,84 @@ jobs: name: spaghetti-linux-x64-${{ matrix.config }} path: spaghetti-${{ matrix.config }} retention-days: 1 + build-docker: + runs-on: ubuntu-latest + strategy: + matrix: + config: [Release] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ hashFiles('script/Dockerfile', 'vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./script/Dockerfile + push: false + load: true + tags: spaghettikart-builder:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Build project in Docker + run: | + docker run --rm \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-builder:latest \ + bash -c " + cp vcpkg.json /tmp/vcpkg.json && \ + cd /tmp && \ + \${VCPKG_ROOT}/vcpkg install --triplet x64-linux && \ + cd /project && \ + cmake -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ matrix.config }} \ + -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux && \ + cmake --build build --parallel + " + + - name: Generate AppImage + run: | + docker run --rm \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-builder:latest \ + bash -c " + cd /project/build && \ + cpack -G External || true + " + + - name: Create Package + run: | + mkdir -p spaghetti-${{ matrix.config }} + cp build/Spaghettify spaghetti-${{ matrix.config }}/ || true + wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt + mv gamecontrollerdb.txt spaghetti-${{ matrix.config }}/ + cp build/*.appimage spaghetti-${{ matrix.config }}/ 2>/dev/null || true + + - name: Publish packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: spaghetti-linux-docker-x64-${{ matrix.config }} + path: spaghetti-${{ matrix.config }} + retention-days: 7 + + # Workaround for cache growing too large + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true
\ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d35c7006..6cff787f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,7 +126,7 @@ jobs: build-macos-intel: needs: generate-port-o2r - runs-on: macOS-13 + runs-on: macOS-latest-intel strategy: matrix: config: [Release, Debug] @@ -344,18 +344,6 @@ jobs: run: | cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} cmake --build build-cmake --config ${{ matrix.config }} -j3 - (cd build-cmake && cpack -G External) - wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt - mv README.md readme.txt - mv build-cmake/*.appimage spaghetti.appimage - - name: Upload build - if: matrix.config == 'Release' - uses: actions/upload-artifact@v4 - with: - name: spaghetti-linux-x64 - path: | - spaghetti.appimage - gamecontrollerdb.txt build-linux-docker: needs: generate-port-o2r @@ -383,6 +371,87 @@ jobs: - name: Build spaghetti run: docker run --rm -v ${PWD}:/project spaghetti cmake --build build-cmake --config ${{ matrix.config }} -j$(nproc) + build-docker: + runs-on: ubuntu-latest + strategy: + matrix: + config: [Release] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ hashFiles('script/Dockerfile', 'vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./script/Dockerfile + push: false + load: true + tags: spaghettikart-builder:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Build project in Docker + run: | + docker run --rm \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-builder:latest \ + bash -c " + cp vcpkg.json /tmp/vcpkg.json && \ + cd /tmp && \ + \${VCPKG_ROOT}/vcpkg install --triplet x64-linux && \ + cd /project && \ + cmake -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ matrix.config }} \ + -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux && \ + cmake --build build --parallel + " + + - name: Generate AppImage + run: | + docker run --rm \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-builder:latest \ + bash -c " + cd /project/build && \ + cpack -G External || true + " + + - name: Create Package + run: | + mkdir -p spaghetti-${{ matrix.config }} + cp build/Spaghettify spaghetti-${{ matrix.config }}/ || true + wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt + mv gamecontrollerdb.txt spaghetti-${{ matrix.config }}/ + cp build/*.appimage spaghetti-${{ matrix.config }}/ 2>/dev/null || true + + - name: Publish packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: spaghetti-linux-x64 + path: spaghetti-${{ matrix.config }} + + # Workaround for cache growing too large + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true + build-switch: needs: generate-port-o2r runs-on: ubuntu-latest |
