Skip to content

Commit

Permalink
Set up CI builds for new opus branch
Browse files Browse the repository at this point in the history
  • Loading branch information
brunchboy committed Apr 6, 2024
1 parent 7c09711 commit a904009
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/resources/opus_preview_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:construction: This is pre-release code for people who want to help test [what is going into the backwards-incompatible release that will support the Opus Quad](https://github.com/Deep-Symmetry/beat-link/blob/opus/CHANGELOG.md).

> Don’t download this if you aren’t comfortable testing code while it is under active development! Instead, look at the [latest release](https:///github.com/Deep-Symmetry/beat-link/releases/latest).
The API docs for the latest Opus-compatible preview release can be viewed [here](https://deepsymmetry.org/beatlink/opus-snapshot/apidocs/).
2 changes: 1 addition & 1 deletion .github/resources/preview_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:construction: This is pre-release code for people who want to help test [what is going into the next release](https://github.com/Deep-Symmetry/beat-link/blob/master/CHANGELOG.md).
:construction: This is pre-release code for people who want to help test [what is going into the next release](https://github.com/Deep-Symmetry/beat-link/blob/main/CHANGELOG.md).

> Don’t download this if you aren’t comfortable testing code while it is under active development! Instead, look at the [latest release](https:///github.com/Deep-Symmetry/beat-link/releases/latest).
Expand Down
33 changes: 33 additions & 0 deletions .github/scripts/create_opus_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# See if we are creating a preview release
if [ "$release_snapshot" = true ] ; then

# Create (or move) the latest-preview tag locally, then push it.
echo "Creating tag for opus preview release"
git config --global user.name 'James Elliott'
git config --global user.email 'james@deepsymmetry.org'
git tag latest-opus-preview -m "The latest opus preview release" --force
git push --tags

# Actually create the opus preview release and upload the cross-platform Jar
echo "Creating opus preview release"
gh release create latest-opus-preview "$artifact_name#Library Jar" --prerelease \
--title "Opus preview release being built" \
--notes ":construction: This release is currently being built by GitHub Actions. Come back in a few minutes."

else

# Should not get here, we do not plan to build final releases until this branch is merged to main.
echo "Canceling workflow: opus branch should only build snapshot releases!"
exit 1

# Actually create the release and upload the cross-platform Jar
# echo "Creating final release"
# gh release create "$release_tag" "$artifact_name#Library Jar" --prerelease \
# --title "Release being built" \
# --notes ":construction: This release is currently being built by GitHub Actions. Come back in a few minutes."

fi
21 changes: 21 additions & 0 deletions .github/scripts/delete_opus_preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# Check if the opus preview release exists.
if gh release view latest-opus-preview --json assets --jq '.assets[].name' > preview_assets.txt ; then

echo "There is an opus preview release. Deleting assets..."
while read -r asset; do
echo " Deleting asset $asset:"
gh release delete-asset latest-opus-preview "$asset" --yes
done <preview_assets.txt

echo "Deleting the opus preview release itself:"
gh release delete latest-opus-preview --cleanup-tag --yes

else
echo "No opus preview release found to clean up."
fi

rm -f preview_assets.txt
17 changes: 17 additions & 0 deletions .github/scripts/deploy_opus_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# There is no point in doing this if we lack the SSH key to publish the API documentation.
if [ "$GUIDE_SSH_KEY" != "" ]; then

# Publish the JavaDoc to the right place on the Deep Symmetry web server.
if [ "$release_snapshot" != "true" ]; then
echo "Should not get here, opus branch is expected to only build snapshots!"
exit 1
else
rsync -avz target/apidocs guides@deepsymmetry.org:/var/www/html/beatlink/opus-snapshot
fi
else
echo "No SSH key present, not building API documentation."
fi
16 changes: 16 additions & 0 deletions .github/scripts/finish_opus_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# See if we are creating a preview release
if [ "$release_snapshot" = true ] ; then

# Update the release information on GitHub and reflect that it is ready.
gh release edit latest-opus-preview --title "$release_tag (Opus) preview" --notes-file .github/resources/opus_preview_notes.md

else

echo "We should not be here, only snapshots should be built on the opus branch!"
exit 1

fi
86 changes: 86 additions & 0 deletions .github/workflows/opus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Create opus library jar

on:
push:
branches:
- opus

env:
GH_TOKEN: ${{ github.token }}

jobs:
build_jar:
name: Build library jar
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- name: Check out opus branch
uses: actions/checkout@v4

- name: Install SSH Key
env:
found_ssh_key: ${{ secrets.GUIDE_SSH_KEY }}
if: ${{ env.found_ssh_key != '' }}
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GUIDE_SSH_KEY }}
# noinspection SpellCheckingInspection
known_hosts: 'deepsymmetry.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMKq8T1IXQHNYLgO715YbxTXoVxEsJcha9h1lxyOXpa'

- name: Prepare Java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'corretto'

- name: Determine release tag, library jar name, and snapshot status
# noinspection SpellCheckingInspection
run: |
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_TAG="v$PROJECT_VERSION"
HUMAN_VERSION=${PROJECT_VERSION/SNAPSHOT/Preview}
echo "release_tag=$RELEASE_TAG" >> $GITHUB_ENV
echo "release_name=$PROJECT_VERSION" >> $GITHUB_ENV
echo "built_name=beat-link-$PROJECT_VERSION.jar" >> $GITHUB_ENV
echo "artifact_name=beat-link-$HUMAN_VERSION.jar" >> $GITHUB_ENV
if [[ $RELEASE_TAG =~ .*-SNAPSHOT ]]
then
echo "release_snapshot=true" >> $GITHUB_ENV
else
echo "release_snapshot=false" >> $GITHUB_ENV
fi
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-
- name: Install dependencies and compile
run: mvn compile

- name: Build library jar
run: |
mvn package
mv target/$built_name ./$artifact_name
- name: Delete any pre-existing preview release
if: success()
run: bash .github/scripts/delete_opus_preview.sh

- name: Create release and upload library jar
if: success()
run: bash .github/scripts/create_opus_release.sh

- name: Publish the JavaDoc
if: success()
env:
GUIDE_SSH_KEY: ${{ secrets.GUIDE_SSH_KEY }}
run: bash .github/scripts/deploy_opus_docs.sh

- name: Update release title, description, and status
if: success()
run: bash .github/scripts/finish_opus_release.sh
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ releases of hardware or even firmware updates from Pioneer.
> Issue](https://github.com/Deep-Symmetry/beat-link/issues) or submit
> a pull request so we can all improve our understanding together.
:construction: We finally obtained the hardware, so can now truly
support new features like those introduced with the CDJ-3000 and
DJM-V10, including the fact that there can now be up to six devices
online and on mixer and the new higher-resolution position packets.
:construction: This branch is working on experimental support for the Opus Quad,
which, despite not supporting a DJ-Link network, seems to communicate with rekordbox
to support lighting in a way that will allow us to offer good support in Beat Link
once we reorganize the code to support working that way. There is
[API documentation](https://deepsymmetry.org/beatlink/opus-snapshot/apidocs/)
for that effort as well.

If something isn&rsquo;t working with your hardware, and you don&rsquo;t yet know
the details why, but are willing to learn a little and help figure it
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.deepsymmetry</groupId>
<artifactId>beat-link</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>beat-link</name>
Expand Down

0 comments on commit a904009

Please sign in to comment.