diff --git a/.github/scripts/README.md b/.github/scripts/README.md index b6678d8..4a2326d 100644 --- a/.github/scripts/README.md +++ b/.github/scripts/README.md @@ -1,3 +1,4 @@ # GitHub Scripts -These scripts should be executed at the root directory of each project respectively. +These script files should be only used by GitHub Action. +These script files should be executed at the root directory of each project respectively. diff --git a/.github/scripts/linux.sh b/.github/scripts/linux.sh index a129b9b..e006526 100644 --- a/.github/scripts/linux.sh +++ b/.github/scripts/linux.sh @@ -1,10 +1,6 @@ #!/bin/bash set -euo pipefail -YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}" -STB_ROOT="${STB_ROOT:?STB_ROOT must be set}" -ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}" - # Create build directory and enter it mkdir bin cd bin diff --git a/.github/scripts/macos.sh b/.github/scripts/macos.sh index a129b9b..e006526 100644 --- a/.github/scripts/macos.sh +++ b/.github/scripts/macos.sh @@ -1,10 +1,6 @@ #!/bin/bash set -euo pipefail -YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}" -STB_ROOT="${STB_ROOT:?STB_ROOT must be set}" -ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}" - # Create build directory and enter it mkdir bin cd bin diff --git a/.github/scripts/stb-linux.sh b/.github/scripts/stb/linux.sh similarity index 66% rename from .github/scripts/stb-linux.sh rename to .github/scripts/stb/linux.sh index 181d01d..18ecff6 100644 --- a/.github/scripts/stb-linux.sh +++ b/.github/scripts/stb/linux.sh @@ -1,2 +1,2 @@ # Just directly record self as root directory -set STB_ROOT=$(pwd) +export STB_ROOT=$(pwd) diff --git a/.github/scripts/stb-macos.sh b/.github/scripts/stb/macos.sh similarity index 66% rename from .github/scripts/stb-macos.sh rename to .github/scripts/stb/macos.sh index 181d01d..18ecff6 100644 --- a/.github/scripts/stb-macos.sh +++ b/.github/scripts/stb/macos.sh @@ -1,2 +1,2 @@ # Just directly record self as root directory -set STB_ROOT=$(pwd) +export STB_ROOT=$(pwd) diff --git a/.github/scripts/stb-windows.bat b/.github/scripts/stb/windows.bat similarity index 100% rename from .github/scripts/stb-windows.bat rename to .github/scripts/stb/windows.bat diff --git a/.github/scripts/yycc-linux.sh b/.github/scripts/yycc/linux.sh similarity index 92% rename from .github/scripts/yycc-linux.sh rename to .github/scripts/yycc/linux.sh index d9fbc65..1ecd2cf 100644 --- a/.github/scripts/yycc-linux.sh +++ b/.github/scripts/yycc/linux.sh @@ -17,7 +17,7 @@ cd .. # Record install directory cd install -set YYCCommonplace_ROOT=$(pwd) +export YYCCommonplace_ROOT=$(pwd) cd .. # Back to root directory diff --git a/.github/scripts/yycc-macos.sh b/.github/scripts/yycc/macos.sh similarity index 92% rename from .github/scripts/yycc-macos.sh rename to .github/scripts/yycc/macos.sh index d9fbc65..1ecd2cf 100644 --- a/.github/scripts/yycc-macos.sh +++ b/.github/scripts/yycc/macos.sh @@ -17,7 +17,7 @@ cd .. # Record install directory cd install -set YYCCommonplace_ROOT=$(pwd) +export YYCCommonplace_ROOT=$(pwd) cd .. # Back to root directory diff --git a/.github/scripts/yycc-windows.bat b/.github/scripts/yycc/windows.bat similarity index 100% rename from .github/scripts/yycc-windows.bat rename to .github/scripts/yycc/windows.bat diff --git a/.github/scripts/zlib-linux.sh b/.github/scripts/zlib/linux.sh similarity index 94% rename from .github/scripts/zlib-linux.sh rename to .github/scripts/zlib/linux.sh index 23280c4..790abbb 100644 --- a/.github/scripts/zlib-linux.sh +++ b/.github/scripts/zlib/linux.sh @@ -7,7 +7,7 @@ mkdir install # Record install directory first because build step require it cd install -set ZLIB_ROOT=$(pwd) +export ZLIB_ROOT=$(pwd) cd .. # Build in Release mode diff --git a/.github/scripts/zlib-macos.sh b/.github/scripts/zlib/macos.sh similarity index 94% rename from .github/scripts/zlib-macos.sh rename to .github/scripts/zlib/macos.sh index 23280c4..790abbb 100644 --- a/.github/scripts/zlib-macos.sh +++ b/.github/scripts/zlib/macos.sh @@ -7,7 +7,7 @@ mkdir install # Record install directory first because build step require it cd install -set ZLIB_ROOT=$(pwd) +export ZLIB_ROOT=$(pwd) cd .. # Build in Release mode diff --git a/.github/scripts/zlib-windows.bat b/.github/scripts/zlib/windows.bat similarity index 100% rename from .github/scripts/zlib-windows.bat rename to .github/scripts/zlib/windows.bat diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5d7155f..07b301f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -24,8 +24,7 @@ jobs: shell: bash run: | cd extern/YYCCommonplace - chmod +x ../../.github/scripts/yycc-linux.sh - source ../../.github/scripts/yycc-linux.sh + source ../../.github/scripts/yycc/linux.sh echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Fetch ZLIB @@ -38,8 +37,7 @@ jobs: shell: bash run: | cd extern/zlib - chmod +x ../../.github/scripts/zlib-linux.sh - source ../../.github/scripts/zlib-linux.sh + source ../../.github/scripts/zlib/linux.sh echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Fetch STB @@ -52,18 +50,22 @@ jobs: shell: bash run: | cd extern/stb - chmod +x ../../.github/scripts/stb-linux.sh - source ../../.github/scripts/stb-linux.sh + source ../../.github/scripts/stb/linux.sh echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Build LibCmo shell: bash run: | - chmod +x ./.github/scripts/linux.sh - ./.github/scripts/linux.sh + source ./.github/scripts/linux.sh - name: Upload Built Artifact uses: actions/upload-artifact@v4 with: name: LibCmo-linux-build path: bin/install/* + retention-days: 30 + - name: Upload Built ependencies + uses: actions/upload-artifact@v4 + with: + name: LibCmo-linux-dep + path: extern/zlib/install/* retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 2c75584..ca54d93 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,8 +19,7 @@ jobs: shell: bash run: | cd extern/YYCCommonplace - chmod +x ../../.github/scripts/yycc-macos.sh - source ../../.github/scripts/yycc-macos.sh + source ../../.github/scripts/yycc/macos.sh echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Fetch ZLIB @@ -33,8 +32,7 @@ jobs: shell: bash run: | cd extern/zlib - chmod +x ../../.github/scripts/zlib-macos.sh - source ../../.github/scripts/zlib-macos.sh + source ../../.github/scripts/zlib/macos.sh echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Fetch STB @@ -47,18 +45,22 @@ jobs: shell: bash run: | cd extern/stb - chmod +x ../../.github/scripts/stb-macos.sh - source ../../.github/scripts/stb-macos.sh + source ../../.github/scripts/stb/macos.sh echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV" cd ../.. - name: Build LibCmo shell: bash run: | - chmod +x ./.github/scripts/macos.sh - ./.github/scripts/macos.sh + source ./.github/scripts/macos.sh - name: Upload Built Artifact uses: actions/upload-artifact@v4 with: name: LibCmo-macos-build path: bin/install/* - retention-days: 30 \ No newline at end of file + retention-days: 30 + - name: Upload Built ependencies + uses: actions/upload-artifact@v4 + with: + name: LibCmo-linux-dep + path: extern/zlib/install/* + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 784c47b..1a9277f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,10 +25,10 @@ jobs: - name: Build YYCCommonplace shell: cmd run: | - cd extern/YYCCommonplace - call ..\..\.github\scripts\yycc-windows.bat - echo set YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ../envs.bat - cd ../.. + CD extern\YYCCommonplace + CALL ..\..\.github\scripts\yycc\windows.bat + ECHO SET YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ..\envs.bat + CD ..\.. - name: Fetch ZLIB uses: actions/checkout@v4 with: @@ -38,10 +38,10 @@ jobs: - name: Build ZLIB shell: cmd run: | - cd extern/zlib - ..\..\.github\scripts\zlib-windows.bat - echo set ZLIB_ROOT=%ZLIB_ROOT% >> ../envs.bat - cd ../.. + CD extern/zlib + ..\..\.github\scripts\zlib\windows.bat + ECHO SET ZLIB_ROOT=%ZLIB_ROOT% >> ..\envs.bat + CD ..\.. - name: Fetch STB uses: actions/checkout@v4 with: @@ -51,10 +51,10 @@ jobs: - name: Build STB shell: cmd run: | - cd extern/stb - ..\..\.github\scripts\stb-windows.bat - echo set STB_ROOT=%STB_ROOT% >> ../envs.bat - cd ../.. + CD extern/stb + ..\..\.github\scripts\stb\windows.bat + ECHO SET STB_ROOT=%STB_ROOT% >> ..\envs.bat + CD ..\.. - name: Build LibCmo shell: cmd run: | @@ -64,13 +64,19 @@ jobs: if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" call %VCVARS% ${{ matrix.msvc_arch }} :: Extract saved environment variables - call .\extern\envs.bat + CALL .\extern\envs.bat :: Build Project - .\.github\scripts\windows.bat + CALL .\.github\scripts\windows.bat - name: Upload Built Artifact uses: actions/upload-artifact@v4 with: name: LibCmo-windows-build path: bin/install/* retention-days: 30 + - name: Upload Built Dependencies + uses: actions/upload-artifact@v4 + with: + name: LibCmo-windows-dep + path: extern/zlib/install/* + retention-days: 30 \ No newline at end of file