Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh action ng 2 #7

Merged
merged 8 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 15 additions & 36 deletions .github/workflows/_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,26 @@ jobs:
strategy:
matrix: ${{ fromJson(needs._preset.outputs.matrix) }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ startsWith(matrix.os, 'windows') && 'pwsh' || 'bash' }}
working-directory: ${{ github.workspace }}
env:
INST_DIR: "${{ github.workspace }}/${{ github.workflow }}"
INST_DIR: ${{ github.workspace }}/${{ github.workflow }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_GHA_KEY: ${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
CCACHE_GHA_KEY_RESTORE: ${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}
PKG_ZIP_NAME: ${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }}
steps:
- name: clone with gh
run: |
gh repo clone ${{ github.repositoryUrl }} . -- --no-checkout --single-branch --depth=1
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}; git checkout FETCH_HEAD
- name: install required software(s)
run: |
brew list -l; brew install ccache nasm
if [[ ${{ startsWith(matrix.os, 'macos') }} ]]; then
brew list -l; brew install ccache nasm tree
fi
- name: gh action ccache restore
uses: actions/cache/restore@v4
with:
Expand All @@ -92,41 +99,13 @@ jobs:
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CCACHE_GHA_KEY }}
- name: set required env `_PKG_ZIP_NAME`
run: |
echo "_PKG_ZIP_NAME=${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }}" >> "$GITHUB_ENV"
- name: compress library - ${{ github.workflow }}
run: |
zip -ry "${{ env._PKG_ZIP_NAME }}.zip" ${{ github.workflow }}
- name: upload library - ${{ github.workflow }}
uses: actions/upload-artifact@v4
with:
name: ${{ env._PKG_ZIP_NAME }}
path: ${{ env._PKG_ZIP_NAME }}.zip

_upload:
needs:
- _preset
- _buildx
runs-on: ubuntu-latest
env:
_PUSH_CAN_EXE: ${{ github.event_name == 'push' && (! inputs.disable_upload) }}
steps:
- name: clone with gh
run: |
gh repo clone ${{ github.repositoryUrl }} . -- --no-checkout --single-branch --depth=1
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}; git checkout FETCH_HEAD
- name: download ${{ github.workflow }} libraries
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/${{ github.workflow }}
- name: commit to pre-compiled packages
if: ${{ env._PUSH_CAN_EXE == 'true' }}
name: ${{ env.PKG_ZIP_NAME }}
path: ${{ env.INST_DIR }}
- name: commit to pre-compiled storage
if: ${{ github.event_name == 'push' && (! inputs.disable_upload) }}
run: |
mkdir -p '${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}'
mv -f ${{ github.workspace }}/${{ github.workflow }}/*/*.zip '${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}'

for ZIP in `ls -- ${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}`; do
./.github/oss_v4.py push "${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}/${ZIP}" \
"${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}/${ZIP}"
done
zip -ry "${{ env.PKG_ZIP_NAME }}.zip" ${{ github.workflow }}
./.github/oss_v4.py push "${{ env.PKG_ZIP_NAME }}.zip" "${{ github.workflow }}/${{ needs._preset.outputs.pkgver }}/${{ env.PKG_ZIP_NAME }}.zip"
40 changes: 14 additions & 26 deletions scripts/ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# ----------------------------
source "${PROJ_ROOT}/pkg-conf.sh"
dl_pkgc mbedtls '2ca6c28' static '' '--enable-mbedtls'
dl_pkgc sdl2 'fb14975' static '' ''
dl_pkgc sdl2 'ba2f78a' static '' ''

printf "\e[1m\e[35m%s\e[0m\n" "${PKG_CONFIG_PATH}"
# ----------------------------
Expand All @@ -16,9 +16,9 @@ case ${PKG_TYPE} in
"static")
PKG_TYPE_FLAG=""
;;
"shared")
PKG_TYPE_FLAG="--disable-static --enable-shared"
;;
# "shared")
# PKG_TYPE_FLAG="--disable-static --enable-shared"
# ;;
*)
printf "\e[1m\e[31m%s\e[0m\n" "Invalid PKG TYPE: '${PKG_TYPE}'."
exit 1
Expand Down Expand Up @@ -49,7 +49,7 @@ pushd -- "${PKG_BULD_DIR}"
CONFIGURE_COMMAND=$(cat <<- EOF
${SUBPROJ_SRC}/configure \
--prefix='${PKG_INST_DIR}' \
--cc='${CC}' --cxx='${CXX}' \
--cc='${CC}' \
${PKG_TYPE_FLAG} \
${PKG_BULD_TYPE} \
${PKG_INST_STRIP} \
Expand All @@ -64,32 +64,22 @@ ${SUBPROJ_SRC}/configure \
--disable-devices \
--enable-indev=lavfi \
--enable-pic \
--disable-libxcb \
--disable-xlib
${PKG_DEPS_ARGS}
EOF
)

case ${PKG_PLATFORM} in
"macosx" | "iphoneos" | "iphonesimulator")
CONFIGURE_COMMAND="${CONFIGURE_COMMAND} \
--enable-cross-compile --sysroot='${SYSROOT}' \
--target-os=darwin --arch=${PKG_ARCH} --disable-coreimage \
--disable-libxcb --disable-xlib
"
;;
*)
;;
esac
case ${PKG_PLATFORM} in
"macosx")
;;
"iphoneos" | "iphonesimulator")
CONFIGURE_COMMAND="${CONFIGURE_COMMAND} --disable-programs"
--enable-cross-compile --sysroot='${SYSROOT}' --target-os=darwin --arch=${PKG_ARCH} --disable-coreimage"
if [ "${PKG_PLATFORM}" != "macosx" ]; then { CONFIGURE_COMMAND="${CONFIGURE_COMMAND} --disable-programs"; } fi
;;
*)
;;
esac

printf "\e[1m\e[36m%s\e[0m\n" "${CONFIGURE_COMMAND}" && eval ${CONFIGURE_COMMAND}
printf "\e[1m\e[36m%s\e[0m\n" "${CONFIGURE_COMMAND}"; eval ${CONFIGURE_COMMAND}
popd

# build & install
Expand All @@ -101,12 +91,10 @@ fi
eval ${MAKE_COMMAND}
popd

rm -rf ${PKG_INST_DIR}/share
# case ${PKG_PLATFORM} in
# "macosx")
# xattr -cs ${PKG_INST_DIR}/bin/*
# ;;
# esac
if [ "${PKG_PLATFORM}" == "macosx" ]; then
rm -rf ${PKG_INST_DIR}/{include,lib,share}
xattr -dr com.apple.quarantine ${PKG_INST_DIR}/bin/*
fi

if command -v tree >/dev/null 2>&1 ; then
tree -L 3 ${PKG_INST_DIR}
Expand Down
2 changes: 1 addition & 1 deletion scripts/llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ cmake -G Ninja \
-D LLDB_USE_SYSTEM_DEBUGSERVER:BOOL=1
EOF
)
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}" && eval ${CMAKE_COMMAND}
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}"; eval ${CMAKE_COMMAND}

# build & install
cmake --build "${PKG_BULD_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/mbedtls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cmake -S "${SUBPROJ_SRC}" -B "${PKG_BULD_DIR}" \
-D ENABLE_PROGRAMS:BOOL=0 -D ENABLE_TESTING:BOOL=0
EOF
)
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}" && eval ${CMAKE_COMMAND}
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}"; eval ${CMAKE_COMMAND}

# build & install
cmake --build "${PKG_BULD_DIR}" -j ${PARALLEL_JOBS}
Expand Down
2 changes: 1 addition & 1 deletion scripts/sdl2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cmake -S "${SUBPROJ_SRC}" -B "${PKG_BULD_DIR}" \
-D SDL2_DISABLE_SDL2MAIN:BOOL=1
EOF
)
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}" && eval ${CMAKE_COMMAND}
printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}"; eval ${CMAKE_COMMAND}

# build & install
cmake --build "${PKG_BULD_DIR}" -j ${PARALLEL_JOBS}
Expand Down