Lint and built Portfile

This commit is contained in:
ReenigneArcher
2022-06-16 16:55:16 -04:00
parent e78ec5c2ce
commit 4a0d632c6e
+183 -98
View File
@@ -297,7 +297,7 @@ jobs:
- name: Package MacOS - name: Package MacOS
run: | run: |
# remove cached artifacts # remove cached artifacts
rm -r -f ./artifacts rm -r -f ./artifacts/
mkdir artifacts mkdir artifacts
mkdir -p artifacts mkdir -p artifacts
@@ -340,103 +340,188 @@ jobs:
last_version: ${{ needs.check_changelog.outputs.last_version }} last_version: ${{ needs.check_changelog.outputs.last_version }}
release_body: ${{ needs.check_changelog.outputs.release_body }} release_body: ${{ needs.check_changelog.outputs.release_body }}
# build_mac_port: build_mac_port:
# name: Macports name: Macports
# runs-on: macos-11 needs: [check_changelog, build_mac]
# needs: [check_changelog, build_mac] runs-on: ${{ matrix.os }}
# strategy:
# steps: matrix:
# - name: Cache Artifacts os: [ macos-10.15, macos-11, macos-12 ]
# uses: actions/cache@v3
# with: steps:
# path: artifacts - name: Cache Artifacts
# key: ${{ runner.os }}-artifacts uses: actions/cache@v3
# with:
# - name: Setup Macports path: artifacts
# run : | key: ${{ runner.os }}-artifacts
# # update paths for macports
# echo "/opt/local/sbin" >> $GITHUB_PATH - name: Checkout ports
# echo "/opt/local/bin" >> $GITHUB_PATH uses: actions/checkout@v3
# with:
# # Set OpenSSL 1.1 as default repository: macports/macports-ports
# # rm -rf /usr/local/opt/openssl fetch-depth: 64
# # rm -rf /usr/local/bin/openssl path: ports
# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/bin/openssl /usr/local/bin/openssl
# # ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o /usr/local/opt/openssl - name: Checkout mpbb
# uses: actions/checkout@v3
# # download and extract macports with:
# curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.7.2.tar.bz2 repository: macports/mpbb
# tar xf MacPorts-2.7.2.tar.bz2 path: mpbb
#
# # build macports - name: Bootstrap MacPorts
# cd MacPorts-2.7.2 run: |
# ./configure # copy Portfile from artifacts to ports
# make mkdir -p ./ports/multimedia/Sunshine
# sudo make install cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile
# cd ../
# rm -rf MacPorts-2.7.2* # display the Portfile
# cat ./ports/multimedia/Sunshine/Portfile
# - name: Configure Macports
# run: | . ports/.github/workflows/bootstrap.sh
# # update sources
# sudo port -v selfupdate - name: Setup Macports
# run : |
# # use custom sources # Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps.
# sudo chmod 777 /opt/local/etc/macports/sources.conf echo "/opt/mports/bin" >> $GITHUB_PATH
# echo file://$(echo ~)/ports > /opt/local/etc/macports/sources.conf echo "${PWD}/mpbb" >> $GITHUB_PATH
# echo rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] >> /opt/local/etc/macports/sources.conf echo "/opt/local/bin" >> $GITHUB_PATH
# sudo chmod 644 /opt/local/etc/macports/sources.conf echo "/opt/local/sbin" >> $GITHUB_PATH
#
# # setup custom port - name: Determine list of subports
# mkdir -p ~/ports/multimedia/sunshine id: subportlist
# run: |
# # copy configured Portfile set -eu
# mv ./artifacts/Portfile ~/ports/multimedia/sunshine/ port=Sunshine
# subportlist=""
# # remove remaining cached artifacts
# rm -r -f ./artifacts echo "Listing subports for Sunshine"
# mkdir artifacts new_subports=$(mpbb \
# --work-dir /tmp/mpbb \
# # index the ports list-subports \
# cd ~/ports --archive-site= \
# portindex --archive-site-private= \
# --include-deps=no \
# - name: Build "$port" \
# run: | | tr '\n' ' ')
# # build port for subport in $new_subports; do
# sudo port install sunshine \ echo "$subport"
# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \ subportlist="$subportlist $subport"
# && exit 1 done
# echo "::set-output name=subportlist::${subportlist}"
# # create packages
# sudo port dmg sunshine - name: Run port lint for all subports
# sudo port pkg sunshine run: |
# set -eu
# # move fail=0
# mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg for subport in $subportlist; do
# mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg echo "::group::${subport}"
# path=$(port file "$subport")
# # testing only messagetype="warning"
# # ls ~/ports/multimedia/sunshine if ! messages=$(port -q lint "$subport" 2>&1); then
# # cat ~/ports/multimedia/sunshine/Portfile messagetype="error"
# # cat /opt/local/etc/macports/sources.conf fail=1
# # cat ~/ports/Portindex fi
# # port search sunshine if [ -n "$messages" ]; then
# echo "$messages"
# - name: Upload Artifacts # See https://github.com/actions/toolkit/issues/193#issuecomment-605394935
# uses: actions/upload-artifact@v3 encoded_messages="port lint ${subport}:%0A"
# with: encoded_messages+="$(echo "${messages}" | sed -E 's/$/%0A/g' | tr -d '\n')"
# name: sunshine-macports echo "::${messagetype} file=${path#${PWD}/ports/},line=1,col=1::${encoded_messages}"
# path: artifacts/ fi
# echo "::endgroup::"
# - name: Create Release done
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} exit "$fail"
# uses: SunshineStream/actions/create_release@master env:
# with: subportlist: ${{ steps.subportlist.outputs.subportlist }}
# token: ${{ secrets.GITHUB_TOKEN }}
# next_version: ${{ needs.check_changelog.outputs.next_version }} - name: Build subports
# last_version: ${{ needs.check_changelog.outputs.last_version }} run: |
# release_body: ${{ needs.check_changelog.outputs.release_body }} set -eu
fail=0
for subport in $subportlist; do
workdir="/tmp/mpbb/$subport"
mkdir -p "$workdir/logs"
touch "$workdir/logs/dependencies-progress.txt"
echo "::group::Cleaning up between ports"
sudo mpbb --work-dir "$workdir" cleanup
echo "::endgroup::"
echo "::group::Installing dependencies for ${subport}"
sudo mpbb \
--work-dir "$workdir" \
install-dependencies \
"$subport" >"$workdir/logs/install-dependencies.log" 2>&1 &
deps_pid=$!
tail -f "$workdir/logs/dependencies-progress.txt" 2>/dev/null &
tail_pid=$!
set +e
wait "$deps_pid"
deps_exit=$?
set -e
kill "$tail_pid" || true
if [ "$deps_exit" -ne 0 ]; then
echo "::endgroup::"
echo "::error::Failed to install dependencies for ${subport}"
fail=1
continue
fi
echo "::endgroup::"
echo "::group::Installing ${subport}"
set +e
sudo mpbb \
--work-dir "$workdir" \
install-port \
--source \
"$subport"
install_exit=$?
set -e
if [ "$install_exit" -ne 0 ]; then
echo "::endgroup::"
echo "::error::Failed to install ${subport}"
fail=1
continue
fi
echo "::endgroup::"
done
exit "$fail"
env:
subportlist: ${{ steps.subportlist.outputs.subportlist }}
- name: Package
run: |
# build port
# sudo port install sunshine \
# || cat /opt/local/var/macports/logs/_Users_runner_ports_multimedia_sunshine/Sunshine/main.log \
# && exit 1
# create packages
sudo port dmg sunshine
sudo port pkg sunshine
# move
mv $(port work sunshine)/Sunshine*.dmg ./artifacts/sunshine.dmg
mv $(port work sunshine)/Sunshine*.ppkg ./artifacts/sunshine.pkg
# testing only
# ls ~/ports/multimedia/sunshine
# cat ~/ports/multimedia/sunshine/Portfile
# cat /opt/local/etc/macports/sources.conf
# cat ~/ports/Portindex
# port search sunshine
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: sunshine-macports
path: artifacts/
- name: Create Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: SunshineStream/actions/create_release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
next_version: ${{ needs.check_changelog.outputs.next_version }}
last_version: ${{ needs.check_changelog.outputs.last_version }}
release_body: ${{ needs.check_changelog.outputs.release_body }}
build_win: build_win:
name: Windows name: Windows