Skip to content

Commit

Permalink
Configure Portfile in Macports job
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Jun 18, 2022
1 parent 6dc10a4 commit 434646a
Showing 1 changed file with 63 additions and 67 deletions.
130 changes: 63 additions & 67 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,6 @@ jobs:
with:
submodules: recursive

# this is for the macports job
- name: Cache Artifacts
uses: actions/cache@v3
with:
path: artifacts
key: ${{ runner.os }}-artifacts

- name: Setup Dependencies MacOS
run: |
# install dependencies using homebrew
Expand All @@ -363,29 +356,9 @@ jobs:
- name: Build MacOS
run: |
# variables for Portfile
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
commit=${{ github.event.pull_request.head.sha }}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=branch=${{ github.ref_name }}
commit=${{ github.sha }}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
echo "Commit: ${commit}"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSUNSHINE_ASSETS_DIR=local/sunshine/assets -DSUNSHINE_CONFIG_DIR=local/sunshine/config -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON ..
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSUNSHINE_ASSETS_DIR=local/sunshine/assets -DSUNSHINE_CONFIG_DIR=local/sunshine/config ..
make -j ${nproc}
- name: Package MacOS
Expand All @@ -407,9 +380,6 @@ jobs:
cpack -G ZIP
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos-experimental-archive.zip
# move
mv Portfile ../artifacts/Portfile
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -436,18 +406,16 @@ jobs:

build_mac_port:
name: Macports
needs: [check_changelog, build_mac]
needs: check_changelog
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-10.15, macos-11, macos-12 ]

steps:
- name: Cache Artifacts
uses: actions/cache@v3
with:
path: artifacts
key: ${{ runner.os }}-artifacts
- name: Checkout
uses: actions/checkout@v3

- name: Checkout ports
uses: actions/checkout@v3
Expand All @@ -462,28 +430,56 @@ jobs:
repository: macports/mpbb
path: mpbb

- name: Bootstrap MacPorts
- name: Setup Dependencies Macports
run: |
# copy Portfile from artifacts to ports
mkdir -p ./ports/multimedia/Sunshine
cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile
# install dependencies using homebrew
brew install cmake
# display the Portfile
cat ./ports/multimedia/Sunshine/Portfile
- name: Configure Portfile
run: |
# variables for Portfile
owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' )
repo=$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]' )
branch=${GITHUB_HEAD_REF}
commit=${{ github.event.pull_request.head.sha }}
# check the branch variable
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch=branch=${{ github.ref_name }}
commit=${{ github.sha }}
else
echo "This is a PR event"
fi
echo "Owner: ${owner}"
echo "Repo: ${repo}"
echo "Branch: ${branch}"
echo "Commit: ${commit}"
mkdir build
cd build
cmake -DGITHUB_OWNER=${owner} -DGITHUB_REPO=${repo} -DGITHUB_BRANCH=${branch} -DSUNSHINE_CONFIGURE_PORTFILE=ON -DSUNSHINE_CONFIGURE_ONLY=ON ..
cd ..
# copy Portfile to artifacts
mkdir -p artifacts
cp -f ./build/Portfile ./artifacts/
# copy Portfile to ports
mkdir -p ./ports/multimedia/Sunshine
cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile
- name: Bootstrap MacPorts
run: |
. ports/.github/workflows/bootstrap.sh
- name: Setup Macports
run : |
# Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps.
echo "/opt/mports/bin" >> $GITHUB_PATH
echo "${PWD}/mpbb" >> $GITHUB_PATH
echo "/opt/local/bin" >> $GITHUB_PATH
echo "/opt/local/sbin" >> $GITHUB_PATH
# copy Portfile from artifacts to ports
mkdir -p ./ports/multimedia/Sunshine
cp -f ./artifacts/Portfile ./ports/multimedia/Sunshine/Portfile
- name: Determine list of subports
id: subportlist
Expand Down Expand Up @@ -586,30 +582,30 @@ jobs:

- 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
sudo port dmg 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
work=$(port work sunshine)
echo "Sunshine port work directory: ${work}"
# testing
ls ${work}
# move components out of port work directory
mv ${work}/Sunshine*component.pkg /tmp/
# copy artifacts
cp ${work}/Sunshine*.pkg ./artifacts/sunshine.pkg
cp ${work}/Sunshine*.dmg ./artifacts/sunshine.dmg
# move components back
mv /tmp/Sunshine*component.pkg ${work}/
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: sunshine-macports
name: sunshine-macports-${{ matrix.os }}
path: artifacts/

- name: Create Release
Expand Down

0 comments on commit 434646a

Please sign in to comment.