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

use ali oss for storage #2

Merged
merged 4 commits into from
May 14, 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
89 changes: 50 additions & 39 deletions .github/workflows/_buildx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on:
required: false
type: boolean

env:
_OSSUTIL_VER: 'v1.7.18'
GH_OSSUTIL_BUCKET: ${{ secrets.GH_OSSUTIL_BUCKET }}
GH_OSSUTIL_PKGS: ${{ secrets.GH_OSSUTIL_PKGS }}
GH_OSSUTIL_CONF_PATH: ${{ github.workspace }}/ossutilconfig

jobs:
_buildx:
strategy:
Expand All @@ -40,12 +46,27 @@ jobs:
uses: actions/checkout@v4
with:
path: ${{ env._REPO_THIS }}
fetch-depth: 0
lfs: true
- name: install required software(s)
run: |
brew list -l
brew install ccache nasm
- name: setup ali ossutil
run: |
ARCH="$(uname -m)"
case ${ARCH} in
"x86_64")
ARCH="amd64"
;;
?)
printf "\e[1m\e[31m%s\e[0m\n" "Invalid HOST ARCH: '${ARCH}'"
exit 1
;;
esac
curl -fsSL -X GET -o "ossutil.zip" \
--url "https://github.com/aliyun/ossutil/releases/download/${{ env._OSSUTIL_VER }}/ossutil-${{ env._OSSUTIL_VER }}-mac-${ARCH}.zip"
unzip -j ossutil.zip "*/ossutil" -d .; echo "${PWD}" >> "$GITHUB_PATH"

echo -e '${{ secrets.GH_OSSUTIL_CONF }}' > '${GH_OSSUTIL_CONF_PATH}'
- name: gh action ccache restore
uses: actions/cache/restore@v4
with:
Expand Down Expand Up @@ -82,17 +103,6 @@ jobs:
if: ${{ env._SETP_CAN_RUN == 'true' }}
run: |
zip -ry "${{ env._PKG_ZIP_NAME }}.zip" ${{ github.workflow }}
- name: show debug info
run: |
env
echo -e "\n"
echo -e "${PWD}"
echo -e "\n"
ls -Alh -- .
echo -e "\n"
ccache -s
echo -e "\n"
ccache -p
- name: upload library - ${{ github.workflow }}
if: ${{ env._SETP_CAN_RUN == 'true' }}
uses: actions/upload-artifact@v4
Expand All @@ -103,19 +113,32 @@ jobs:
needs: _buildx
runs-on: ubuntu-latest
env:
_REPO_PKGS: "_repo_pkgs"
_PUSH_CAN_EXE: ${{ github.event_name == 'push' && (! inputs.disable_upload) }}
steps:
- name: checkout pkgs repo
uses: actions/checkout@v4
with:
path: ${{ env._REPO_PKGS }}
ref: packages
lfs: true
- name: download ${{ github.workflow }} libraries
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/${{ github.workflow }}
- name: setup ali ossutil
run: |
ARCH="$(uname -m)"
case ${ARCH} in
"x86_64")
ARCH="amd64"
;;
"aarch64")
ARCH="arm64"
;;
?)
printf "\e[1m\e[31m%s\e[0m\n" "Invalid HOST ARCH: '${ARCH}'"
exit 1
;;
esac
curl -fsSL -X GET -o "ossutil.zip" \
--url "https://github.com/aliyun/ossutil/releases/download/${{ env._OSSUTIL_VER }}/ossutil-${{ env._OSSUTIL_VER }}-linux-${ARCH}.zip"
unzip -j ossutil.zip "*/ossutil" -d .; echo "${PWD}" >> "$GITHUB_PATH"

echo -e '${{ secrets.GH_OSSUTIL_CONF }}' > '${GH_OSSUTIL_CONF_PATH}'
- name: show debug info
run: |
env
Expand All @@ -126,23 +149,11 @@ jobs:
echo -e "\n"
ls -AlhR ${{ github.workflow }}
- name: commit to pre-compiled packages
if: ${{ env._PUSH_CAN_EXE == 'true' }}
run: |
pushd -- "${{ env._REPO_PKGS }}"
{
git config user.name "${{ github.run_id }}@gh-action"
git config user.email "${{ github.run_id }}@gh-action"
git config --list

mkdir -p '${{ github.workflow }}/${{ needs._buildx.outputs.version }}'
mv -f ${{ github.workspace }}/${{ github.workflow }}/*/*.zip '${{ github.workflow }}/${{ needs._buildx.outputs.version }}'

git lfs track ${{ github.workflow }}/${{ needs._buildx.outputs.version }}/*.zip
git add .gitattributes

git add .
git status
git commit -m "gh action: ${{ github.workflow }}/${{ needs._buildx.outputs.version }}/${{ github.run_id }}"

if ${{ env._PUSH_CAN_EXE == 'true' }}; then { git push; } fi
}
popd
mkdir -p '${{ github.workflow }}/${{ needs._buildx.outputs.version }}'
mv -f ${{ github.workspace }}/${{ github.workflow }}/*/*.zip '${{ github.workflow }}/${{ needs._buildx.outputs.version }}'
ossutil cp \
${{ github.workflow }}/${{ needs._buildx.outputs.version }} \
oss://${GH_OSSUTIL_BUCKET}/${GH_OSSUTIL_PKGS}/${{ github.workflow }}/${{ needs._buildx.outputs.version }} \
--include "*.zip" -r --only-current-dir --disable-dir-object -c '${GH_OSSUTIL_CONF_PATH}'
33 changes: 0 additions & 33 deletions .github/workflows/ffmpeg.yml

This file was deleted.

29 changes: 21 additions & 8 deletions pkg-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,30 @@ function dl_pkgc() {
pkg_version="${2}"
pkg_type="${3}"
pkg_extra="${4}"
dl_filename="${pkg_name}_${PKG_PLATFORM}_${PKG_ARCH}_${pkg_version}_${pkg_type}.zip"
if [ -n "${pkg_extra}" ]; then
dl_filename="${pkg_name}_${PKG_PLATFORM}_${PKG_ARCH}_${pkg_version}_${pkg_type}_${pkg_extra}.zip"
fi
printf "\e[1m\e[36m%s\e[0m\n" "dl_filename='${dl_filename}'"

pushd -- "${PKG_DEPS_PATH}"
{
set -x
ln -sfn ../out/${pkg_name}/${PKG_PLATFORM}/${PKG_ARCH} ${pkg_name}
set +x
if [ "${GITHUB_ACTIONS}" == "true" ]; then
{
dl_filename="${pkg_name}_${PKG_PLATFORM}_${PKG_ARCH}_${pkg_version}_${pkg_type}.zip"
if [ -n "${pkg_extra}" ]; then
dl_filename="${pkg_name}_${PKG_PLATFORM}_${PKG_ARCH}_${pkg_version}_${pkg_type}_${pkg_extra}.zip"
fi
printf "\e[1m\e[36m%s\e[0m\n" "dl_filename='${dl_filename}'"

ossutil cp \
oss://${GH_OSSUTIL_BUCKET}/${GH_OSSUTIL_PKGS}/${pkg_name}/${pkg_version}/${dl_filename} \
./${pkg_name}.zip \
-c ${GH_OSSUTIL_CONF_PATH}
unzip -q "${pkg_name}.zip"
}
else
{
set -x
ln -sfn ../out/${pkg_name}/${PKG_PLATFORM}/${PKG_ARCH} ${pkg_name}
set +x
}
fi
}
popd
)
Expand Down