-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,115 +11,102 @@ jobs: | |
runs-on: ${{ matrix.platform }} | ||
env: | ||
BUILDROOT: "buildroot_${{ matrix.platform }}" | ||
GIT_DEPENDENCIES: tihmstar/libgeneral | ||
MAC_DYNAMIC_LIBS: openssl,libplist | ||
GIT_DEPENDENCIES: libgeneral,libplist | ||
MAC_DYNAMIC_LIBS: openssl | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: prepre buildroot | ||
run: mkdir $BUILDROOT | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install pre-dependencies | ||
run: | | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
sudo apt-get install -y libssl-dev | ||
# install liblzfse | ||
git clone https://github.com/lzfse/lzfse.git | ||
make -C lzfse CFLAGS="-fPIC" | ||
make -C lzfse INSTALL_PREFIX=$GITHUB_WORKSPACE/$BUILDROOT install | ||
sudo make -C lzfse install | ||
rm -rf lzfse | ||
#install libplist-2.0 because libplist-dev is called "libplist v2.0.0" | ||
git clone https://github.com/libimobiledevice/libplist | ||
cd libplist | ||
./autogen.sh --without-cython --enable-static --disable-shared CFLAGS="-fPIC" CXXFLAGS="-fPIC" | ||
make | ||
sudo make install | ||
cd .. | ||
rm -rf libplist | ||
sudo apt-get update | ||
sudo apt-get install -y jq libssl-dev | ||
# install liblzfse | ||
git clone https://github.com/lzfse/lzfse.git | ||
make -C lzfse CFLAGS="-fPIC" | ||
make -C lzfse INSTALL_PREFIX=$GITHUB_WORKSPACE/$BUILDROOT install | ||
sudo make -C lzfse install | ||
rm -rf lzfse | ||
elif [ "$RUNNER_OS" == "macOS" ]; then | ||
brew install autoconf automake libtool pkg-config openssl libplist | ||
cd $(brew --prefix openssl) | ||
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/ | ||
cd $GITHUB_WORKSPACE | ||
brew install autoconf automake libtool jq pkg-config | ||
brew install openssl | ||
cd $(brew --prefix openssl) | ||
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/ | ||
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do | ||
echo "moving library $d" | ||
cd $(brew --prefix $d) | ||
find . -name "*.dylib" -exec mv {} {}.bak \; | ||
done | ||
cd $GITHUB_WORKSPACE | ||
else | ||
echo "$RUNNER_OS not supported" | ||
exit 1 | ||
echo "$RUNNER_OS not supported" | ||
exit 1 | ||
fi | ||
shell: bash | ||
- name: download dependencies | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
get_latest_release() { | ||
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | ||
grep '"tag_name":' | # Get tag line | ||
rev | cut -d '"' -f2 | rev # Pluck JSON value | ||
url="https://api.github.com/repos/$1/releases/latest" | ||
echo "url: ${url}" >&2 | ||
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "${url}" | # Get latest release from GitHub api | ||
jq .tag_name | # Get tag | ||
tr -d '"' # Strip quotes | ||
} | ||
mkdir depdir | ||
cd depdir | ||
mkdir $BUILDROOT | ||
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do | ||
echo "Got dependency: $d" | ||
r=$(echo $d | cut -d '/' -f 2) | ||
echo "Got reponame: $r" | ||
tag=$(get_latest_release $d); | ||
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do | ||
dep=$d | ||
if ! echo ${dep} | grep -q '/'; then | ||
dep=${{ github.repository_owner }}/${dep} | ||
fi | ||
echo "Got dependency: ${dep}" | ||
tag=$(get_latest_release ${dep}); | ||
echo "Found tag: $tag" | ||
wget "https://github.com/$d/releases/download/$tag/$BUILDROOT.zip" | ||
wget "https://github.com/${dep}/releases/download/$tag/$BUILDROOT.zip" | ||
unzip -u "$BUILDROOT.zip" | ||
rm "$BUILDROOT.zip" | ||
done | ||
echo "moving dependencies to /" | ||
sudo cp -r $BUILDROOT/* / | ||
cd .. | ||
rm -rf depdir | ||
- name: prepre buildroot | ||
run: mkdir -p $BUILDROOT | ||
- name: autogen | ||
run: ./autogen.sh --enable-static --disable-shared | ||
- name: make | ||
run: | | ||
if [ "$RUNNER_OS" == "macOS" ]; then | ||
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do | ||
echo "moving library $d" | ||
cd $(brew --prefix $d) | ||
find . -name "*.dylib" -exec mv {} {}.bak \; | ||
done | ||
cd $GITHUB_WORKSPACE | ||
make | ||
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do | ||
echo "restoring library $d" | ||
cd $(brew --prefix $d) | ||
find . -name "*.dylib.bak" | while read f; do o=$(echo $f | rev | cut -d '.' -f2- | rev); mv $f $o; done | ||
done | ||
cd $GITHUB_WORKSPACE | ||
else | ||
make | ||
fi | ||
run: make -j || make | ||
- name: make install | ||
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install | ||
- uses: actions/upload-artifact@v1 | ||
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.BUILDROOT }} | ||
path: ${{ env.BUILDROOT }} | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download ubuntu artifact | ||
uses: actions/download-artifact@v1 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: buildroot_ubuntu-latest | ||
path: buildroot_ubuntu-latest | ||
- name: Download macos artifact | ||
uses: actions/download-artifact@v1 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: buildroot_macos-latest | ||
path: buildroot_macos-latest | ||
|
@@ -133,33 +120,16 @@ jobs: | |
zip -r buildroot_ubuntu-latest.zip buildroot_ubuntu-latest | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/[email protected] | ||
uses: softprops/action-gh-release@v2 | ||
if: github.ref == 'refs/heads/master' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
prerelease: false | ||
draft: false | ||
tag_name: ${{ env.BUILD_VERSION_NUM }} | ||
release_name: Build ${{ env.BUILD_VERSION_STR }} | ||
name: Build ${{ env.BUILD_VERSION_STR }} | ||
body: ${{ env.COMMIT_MSG }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset ubuntu | ||
id: upload-release-asset-ubuntu | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: buildroot_ubuntu-latest.zip | ||
asset_name: buildroot_ubuntu-latest.zip | ||
asset_content_type: application/zip | ||
- name: Upload Release Asset macos | ||
id: upload-release-asset-macos | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: buildroot_macos-latest.zip | ||
asset_name: buildroot_macos-latest.zip | ||
asset_content_type: application/zip | ||
|
||
files: | | ||
buildroot_ubuntu-latest.zip | ||
buildroot_macos-latest.zip |