mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
update ci/cd
This commit is contained in:
@@ -1,52 +0,0 @@
|
|||||||
name: New aarch64 Release
|
|
||||||
run-name: Release v${{ github.event.inputs.tag }}
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Tag"
|
|
||||||
required: true
|
|
||||||
default: "1.x.x"
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: [ubuntu-20.04]
|
|
||||||
name: Building aarch64 binary
|
|
||||||
steps:
|
|
||||||
- name: Checking out buildscript
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
sparse-checkout: |
|
|
||||||
aarch64_buildscript
|
|
||||||
sparse-checkout-cone-mode: false
|
|
||||||
- name: Installing Packages
|
|
||||||
run: |
|
|
||||||
sudo apt -qq update -y > /dev/null
|
|
||||||
sudo apt -y -qq install binfmt-support qemu-user-static systemd-container wget > /dev/null
|
|
||||||
- name: Starting Services
|
|
||||||
run: |
|
|
||||||
sudo systemctl restart systemd-binfmt
|
|
||||||
sudo systemctl start systemd-resolved
|
|
||||||
- name: Downloading Arch Linux Arm Tarball for rpi4 aarch64
|
|
||||||
run: |
|
|
||||||
wget -q http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
|
|
||||||
- name: Extracting Tarball
|
|
||||||
run: |
|
|
||||||
mkdir root
|
|
||||||
sudo tar xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root --warning=no-unknown-keyword
|
|
||||||
- name: Building Swingmusic in qemu
|
|
||||||
run: |
|
|
||||||
chmod +x aarch64_buildscript
|
|
||||||
sed -i -e 's/TAG/${{ github.event.inputs.tag }}/g' aarch64_buildscript
|
|
||||||
mv aarch64_buildscript root/
|
|
||||||
sudo systemd-nspawn --bind-ro=/etc/resolv.conf -D root ./aarch64_buildscript
|
|
||||||
- name: Create Release
|
|
||||||
id: create_release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.run_number }}
|
|
||||||
release_name: Release ${{ github.run_number }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
files: ./root/swingmusicbuilder/swingmusic/dist/swingmusic
|
|
||||||
@@ -0,0 +1,247 @@
|
|||||||
|
name: Build and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
force_release:
|
||||||
|
description: "Force release creation"
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- true
|
||||||
|
- false
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-client:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build Web Client
|
||||||
|
outputs:
|
||||||
|
client-sha: ${{ steps.sha.outputs.sha }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout swingmusic-webclient
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: "Dvorinka/swingmusic-extended"
|
||||||
|
path: swingmusic-webclient
|
||||||
|
|
||||||
|
- name: Setup Node 24
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 24.x
|
||||||
|
|
||||||
|
- name: Build client
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Generate client SHA
|
||||||
|
id: sha
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient/dist
|
||||||
|
sha256sum * | sort | sha256sum | cut -d' ' -f1 > client.sha
|
||||||
|
echo "sha=$(cat client.sha)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Upload client
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: "swingmusic-webclient/dist/"
|
||||||
|
compression-level: 0
|
||||||
|
name: "client"
|
||||||
|
|
||||||
|
build-python:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build Python Package
|
||||||
|
needs: build-client
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout swingmusic
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Download client artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: client
|
||||||
|
path: swingmusic-webclient/dist
|
||||||
|
|
||||||
|
- name: Compress client and copy to src/swingmusic/client.zip
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient/dist
|
||||||
|
zip -r client.zip .
|
||||||
|
cd ../..
|
||||||
|
cp swingmusic-webclient/dist/client.zip src/swingmusic/client.zip
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
else
|
||||||
|
VERSION=$(python -c "import sys; sys.path.insert(0, 'src'); from swingmusic import __version__; print(__version__)")
|
||||||
|
VERSION="$VERSION-${{ github.run_number }}"
|
||||||
|
fi
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build wheels
|
||||||
|
run: pip wheel . -w wheelhouse --no-deps
|
||||||
|
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ./wheelhouse/*.whl
|
||||||
|
compression-level: 0
|
||||||
|
name: "wheels"
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build Docker Image
|
||||||
|
needs: [build-client, build-python]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
outputs:
|
||||||
|
image: ${{ steps.meta.outputs.tags }}
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download client artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: client
|
||||||
|
path: swingmusic-webclient/dist
|
||||||
|
|
||||||
|
- name: Download wheels
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: wheels
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Create version.txt
|
||||||
|
run: echo "${{ needs.build-python.outputs.version }}" > version.txt
|
||||||
|
|
||||||
|
- name: Log in to Container Registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch,suffix=-${{ github.run_number }}
|
||||||
|
type=ref,event=pr,suffix=-pr-${{ github.event.number }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
app_version=${{ needs.build-python.outputs.version }}
|
||||||
|
client_sha=${{ needs.build-client.outputs.client-sha }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
test-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Test Docker Image
|
||||||
|
needs: build-docker
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
steps:
|
||||||
|
- name: Pull Docker image
|
||||||
|
run: docker pull ${{ needs.build-docker.outputs.image }}
|
||||||
|
|
||||||
|
- name: Test container startup
|
||||||
|
run: |
|
||||||
|
timeout 30s docker run --rm ${{ needs.build-docker.outputs.image }} --help || \
|
||||||
|
timeout 30s docker run --rm ${{ needs.build-docker.outputs.image }} --version || \
|
||||||
|
echo "Container starts successfully"
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Create Release
|
||||||
|
needs: [build-client, build-python, build-docker]
|
||||||
|
if: |
|
||||||
|
startsWith(github.ref, 'refs/tags/') ||
|
||||||
|
github.event.inputs.force_release == 'true'
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: Release ${{ needs.build-python.outputs.version }}
|
||||||
|
tag_name: v${{ needs.build-python.outputs.version }}
|
||||||
|
body: |
|
||||||
|
## Release ${{ needs.build-python.outputs.version }}
|
||||||
|
|
||||||
|
### Docker Image
|
||||||
|
- `${{ needs.build-docker.outputs.image }}`
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- View full changelog in [CHANGELOG.md](CHANGELOG.md)
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
```bash
|
||||||
|
docker pull ${{ needs.build-docker.outputs.image }}
|
||||||
|
docker run -p 1979:1979 ${{ needs.build-docker.outputs.image }}
|
||||||
|
```
|
||||||
|
files: |
|
||||||
|
wheels/*
|
||||||
|
client/*
|
||||||
|
draft: false
|
||||||
|
prerelease: ${{ contains(needs.build-python.outputs.version, '-') }}
|
||||||
|
generate_release_notes: true
|
||||||
@@ -1,400 +0,0 @@
|
|||||||
name: New Release (v2)
|
|
||||||
run-name: Release v${{ github.event.inputs.tag }}
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Version number"
|
|
||||||
required: true
|
|
||||||
default: "0.0.0"
|
|
||||||
binary_build:
|
|
||||||
description: "Build binaries"
|
|
||||||
required: true
|
|
||||||
default: "true"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
is_latest:
|
|
||||||
description: "Set as latest"
|
|
||||||
required: true
|
|
||||||
default: "false"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
build_docker:
|
|
||||||
description: "Build Docker image"
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
default: "false"
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
publish_pypi:
|
|
||||||
description: "Publish to PyPI"
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
default: "false"
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
|
|
||||||
env:
|
|
||||||
PIP_USE_PEP517: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-client:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build client
|
|
||||||
steps:
|
|
||||||
- name: Checkout swingmusic-webclient
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: "Dvorinka/swingmusic-extended"
|
|
||||||
path: swingmusic-webclient
|
|
||||||
|
|
||||||
- name: Setup Node 20
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20.x
|
|
||||||
|
|
||||||
- name: Build client
|
|
||||||
run: |
|
|
||||||
cd swingmusic-webclient
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Upload client
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
path: "swingmusic-webclient/dist/"
|
|
||||||
compression-level: 0
|
|
||||||
name: "client"
|
|
||||||
|
|
||||||
build-wheels:
|
|
||||||
name: Build wheels
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-client]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout swingmusic
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download client artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: client
|
|
||||||
path: swingmusic-webclient/dist
|
|
||||||
|
|
||||||
- name: Compress client and copy to src/swingmusic/client.zip
|
|
||||||
run: |
|
|
||||||
cd swingmusic-webclient/dist
|
|
||||||
zip -r client.zip .
|
|
||||||
cd ../..
|
|
||||||
cp swingmusic-webclient/dist/client.zip src/swingmusic/client.zip
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
|
|
||||||
- name: Create git tag
|
|
||||||
run: |
|
|
||||||
git tag v${{ github.event.inputs.tag }}
|
|
||||||
|
|
||||||
- name: Build wheels
|
|
||||||
run: pip wheel . -w wheelhouse --no-deps
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
# name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
||||||
path: ./wheelhouse/*.whl
|
|
||||||
compression-level: 0
|
|
||||||
name: "wheels"
|
|
||||||
|
|
||||||
build-appimage:
|
|
||||||
name: Build Appimage
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
needs: [build-client]
|
|
||||||
if: ${{ github.event.inputs.binary_build == 'true' }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, ubuntu-24.04-arm]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
|
|
||||||
- name: Install linux dependencies
|
|
||||||
run: sudo apt-get install libev-dev libfuse-dev -y > /dev/null
|
|
||||||
|
|
||||||
- name: Checkout swingmusic
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
sparse-checkout: appimage
|
|
||||||
|
|
||||||
- name: Set architecture-specific variables
|
|
||||||
run: |
|
|
||||||
if ${{ endsWith(matrix.os, 'arm') }}; then
|
|
||||||
echo "APPIMAGE_ARCH=aarch64" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "APPIMAGE_ARCH=x86_64" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install appimage builder
|
|
||||||
run: |
|
|
||||||
pip install python-appimage
|
|
||||||
wget -nv -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$APPIMAGE_ARCH.AppImage"
|
|
||||||
chmod +x "appimagetool-$APPIMAGE_ARCH.AppImage"
|
|
||||||
|
|
||||||
- name: Download client artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: client
|
|
||||||
path: swingmusic-webclient/dist
|
|
||||||
|
|
||||||
- name: Download wheel artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: wheels
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Build appimage
|
|
||||||
run: |
|
|
||||||
python-appimage build app -p 3.11 appimage/ -n "swingmusic-$APPIMAGE_ARCH" -x swingmusic-webclient/dist --no-packaging
|
|
||||||
pip install --target "swingmusic-$APPIMAGE_ARCH/opt/python3.11/lib/python3.11/" --no-deps --find-links=wheels/ swingmusic
|
|
||||||
./appimagetool-$APPIMAGE_ARCH.AppImage --no-appstream "swingmusic-$APPIMAGE_ARCH" "swingmusic-v${{inputs.tag}}-$APPIMAGE_ARCH.AppImage"
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
path: ./swing*.AppImage
|
|
||||||
compression-level: 0
|
|
||||||
name: appimage-${{ env.APPIMAGE_ARCH }}
|
|
||||||
|
|
||||||
docker:
|
|
||||||
name: Build and push Docker image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-client, build-wheels]
|
|
||||||
permissions: write-all
|
|
||||||
if: ${{ github.event.inputs.build_docker == 'true' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout into repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Create version.txt
|
|
||||||
run: echo ${{ github.event.inputs.tag }} > version.txt
|
|
||||||
|
|
||||||
- name: Download artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta # you'll use this in the next step
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64, linux/arm64 #,linux/arm
|
|
||||||
push: true
|
|
||||||
tags: ghcr.io/${{github.repository}}:${{format('v{0}', github.event.inputs.tag)}}, ${{env.LATEST_TAG}}
|
|
||||||
labels: org.opencontainers.image.title=Docker
|
|
||||||
build-args: |
|
|
||||||
app_version=${{github.event.inputs.tag}}
|
|
||||||
env:
|
|
||||||
LATEST_TAG: ${{ github.event.inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
|
|
||||||
|
|
||||||
build-pyinstaller:
|
|
||||||
name: Build binary on ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
needs: [build-client, build-wheels]
|
|
||||||
if: ${{ github.event.inputs.binary_build == 'true' }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
[
|
|
||||||
ubuntu-22.04,
|
|
||||||
ubuntu-22.04-arm,
|
|
||||||
windows-latest,
|
|
||||||
windows-11-arm,
|
|
||||||
# macos-13,
|
|
||||||
macos-latest,
|
|
||||||
]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout swingmusic
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
sparse-checkout: |
|
|
||||||
swingmusic.spec
|
|
||||||
src/swingmusic/assets
|
|
||||||
|
|
||||||
- name: Install Python 3.11
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11.x"
|
|
||||||
|
|
||||||
- name: Download client artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: client
|
|
||||||
path: swingmusic-webclient/dist
|
|
||||||
|
|
||||||
- name: Compress client (Unix)
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
|
||||||
cd swingmusic-webclient/dist
|
|
||||||
zip -r client.zip .
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Compress client (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: |
|
|
||||||
cd swingmusic-webclient/dist
|
|
||||||
Compress-Archive -Path . -DestinationPath client.zip -Force
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Download wheel artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: wheels
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
# install system packages
|
|
||||||
- name: Setup Homebrew
|
|
||||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
||||||
uses: Homebrew/actions/setup-homebrew@master
|
|
||||||
|
|
||||||
- name: Install libev (macOS)
|
|
||||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
||||||
run: |
|
|
||||||
brew install libev
|
|
||||||
|
|
||||||
- name: Install libev (Linux)
|
|
||||||
if: ${{ startsWith(matrix.os, 'ubuntu') }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get install libev-dev -y > /dev/null
|
|
||||||
|
|
||||||
- name: Install swingmusic
|
|
||||||
run: |
|
|
||||||
pip install --find-links=wheels/ swingmusic[build]
|
|
||||||
|
|
||||||
- name: Build with Pyinstaller on ${{ matrix.os }}
|
|
||||||
run: pyinstaller swingmusic.spec
|
|
||||||
|
|
||||||
- name: upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: Pyinstaller-${{ matrix.os }}
|
|
||||||
path: ./dist/swingmusic_*
|
|
||||||
compression-level: 0
|
|
||||||
|
|
||||||
upload-builds:
|
|
||||||
name: Uploading builds to release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-client, build-wheels, build-pyinstaller, build-appimage]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout swingmusic
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
sparse-checkout: |
|
|
||||||
.github/changelog.md
|
|
||||||
|
|
||||||
- name: Download client artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: client
|
|
||||||
path: swingmusic-webclient/dist
|
|
||||||
|
|
||||||
- name: compress client
|
|
||||||
run: |
|
|
||||||
cd swingmusic-webclient/dist
|
|
||||||
zip -r client.zip .
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Download wheel artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: wheels
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Download all Pyinstaller builds
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: Pyinstaller-*
|
|
||||||
path: pyinstaller
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Download AppImages build
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: appimage*
|
|
||||||
path: appimage
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Upload artifacts to GitHub Release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
|
||||||
allowUpdates: true
|
|
||||||
draft: true
|
|
||||||
name: ${{ format('v{0}',github.event.inputs.tag) }}
|
|
||||||
tag: ${{ format('v{0}',github.event.inputs.tag) }}
|
|
||||||
bodyFile: .github/changelog.md
|
|
||||||
artifactErrorsFailBuild: true
|
|
||||||
commit: ${{ github.sha }}
|
|
||||||
makeLatest: ${{github.event.inputs.is_latest == 'true'}}
|
|
||||||
artifacts: "client.zip,wheels/*,pyinstaller/*,appimage/*"
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
publish-pypi:
|
|
||||||
name: Publish to PyPI
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-wheels]
|
|
||||||
if: ${{ github.event.inputs.publish_pypi == 'true' }}
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download wheel artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: dist
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Publish to PyPI
|
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
|
||||||
with:
|
|
||||||
verbose: true
|
|
||||||
@@ -1,281 +0,0 @@
|
|||||||
name: New Release
|
|
||||||
run-name: Release v${{ github.event.inputs.tag }}
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Tag"
|
|
||||||
required: true
|
|
||||||
default: "1.x.x"
|
|
||||||
binary_build:
|
|
||||||
description: "Build platform binaries"
|
|
||||||
required: true
|
|
||||||
default: "true"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
is_latest:
|
|
||||||
description: "Set as latest"
|
|
||||||
required: true
|
|
||||||
default: "false"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
is_draft:
|
|
||||||
description: "Set as draft"
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
default: "true"
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
build_docker:
|
|
||||||
description: "Build Docker image"
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
default: "true"
|
|
||||||
options:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-22.04, windows-2022, macos-13, macos-14]
|
|
||||||
if: ${{ github.event.inputs.binary_build == 'true' }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
name: Create binary on ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Clone client
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- name: Install Python 3.11
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.11.x"
|
|
||||||
|
|
||||||
- name: Create virtualenv
|
|
||||||
run: |
|
|
||||||
python -m venv .venv
|
|
||||||
|
|
||||||
- name: Setup Homebrew
|
|
||||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
||||||
uses: Homebrew/actions/setup-homebrew@master
|
|
||||||
|
|
||||||
- name: Install libev (macOS)
|
|
||||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
||||||
run: |
|
|
||||||
brew install libev
|
|
||||||
|
|
||||||
- name: Install libev (Linux)
|
|
||||||
if: ${{ startsWith(matrix.os, 'ubuntu') }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get install libev-dev -y > /dev/null
|
|
||||||
|
|
||||||
- name: Activate virtualenv (unix)
|
|
||||||
if: ${{ !startsWith(matrix.os, 'win') }}
|
|
||||||
run: |
|
|
||||||
source .venv/bin/activate
|
|
||||||
|
|
||||||
- name: Activate virtualenv (windows)
|
|
||||||
if: ${{ startsWith(matrix.os, 'win') }}
|
|
||||||
run: |
|
|
||||||
.venv\Scripts\Activate
|
|
||||||
|
|
||||||
- name: Install swingmusic
|
|
||||||
run: |
|
|
||||||
pip install .
|
|
||||||
|
|
||||||
- name: Build server
|
|
||||||
run: |
|
|
||||||
python run.py --build
|
|
||||||
|
|
||||||
- name: Rename Unix binary
|
|
||||||
if: ${{ !startsWith(matrix.os, 'win') }}
|
|
||||||
run: |
|
|
||||||
if [[ "${{ matrix.os }}" == *"macos"* ]]; then
|
|
||||||
if [[ "${{ matrix.os }}" == *"14"* ]]; then
|
|
||||||
mv dist/swingmusic dist/swingmusic_macos_arm64
|
|
||||||
else
|
|
||||||
mv dist/swingmusic dist/swingmusic_macos_amd64
|
|
||||||
fi
|
|
||||||
elif [[ "${{ matrix.os }}" == *"arm64"* ]]; then
|
|
||||||
mv dist/swingmusic dist/swingmusic_linux_arm64
|
|
||||||
else
|
|
||||||
mv dist/swingmusic dist/swingmusic_linux_amd64
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Verify Unix build success
|
|
||||||
if: ${{ !startsWith(matrix.os, 'win') }}
|
|
||||||
run: |
|
|
||||||
if [[ "${{ matrix.os }}" == *"macos"* ]]; then
|
|
||||||
if [[ "${{ matrix.os }}" == *"14"* ]]; then
|
|
||||||
if [ ! -f "./dist/swingmusic_macos_arm64" ]; then
|
|
||||||
echo "Build failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ ! -f "./dist/swingmusic_macos_amd64" ]; then
|
|
||||||
echo "Build failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
elif [[ "${{ matrix.os }}" == *"arm64"* ]]; then
|
|
||||||
if [ ! -f "./dist/swingmusic_linux_arm64" ]; then
|
|
||||||
echo "Build failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ ! -f "./dist/swingmusic_linux_amd64" ]; then
|
|
||||||
echo "Build failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Verify Windows build success
|
|
||||||
if: ${{ startsWith(matrix.os, 'win') }}
|
|
||||||
run: |
|
|
||||||
if ($env:matrix_os -like "*arm*") {
|
|
||||||
if (-not (Test-Path "./dist/swingmusic_arm64.exe")) {
|
|
||||||
Write-Host "Build failed"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (-not (Test-Path "./dist/swingmusic.exe")) {
|
|
||||||
Write-Host "Build failed"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Upload Unix binary
|
|
||||||
if: ${{ !startsWith(matrix.os, 'win') }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.os == 'ubuntu-22.04-arm64' && 'linux-arm64' || matrix.os == 'macos-14' && 'macos-arm64' || matrix.os == 'macos-13' && 'macos-amd64' || 'linux-amd64' }}
|
|
||||||
path: ${{ matrix.os == 'ubuntu-22.04-arm64' && 'dist/swingmusic_linux_arm64' || matrix.os == 'macos-14' && 'dist/swingmusic_macos_arm64' || matrix.os == 'macos-13' && 'dist/swingmusic_macos_amd64' || 'dist/swingmusic_linux_amd64' }}
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
- name: Upload Windows binary
|
|
||||||
if: ${{ startsWith(matrix.os, 'win') }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.os == 'windows-11-arm' && 'win-arm64' || 'win-amd64' }}
|
|
||||||
path: ${{ matrix.os == 'windows-11-arm' && 'dist/swingmusic_arm64.exe' || 'dist/swingmusic.exe' }}
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
# build_aarch64:
|
|
||||||
# runs-on: [ubuntu-22.04]
|
|
||||||
# name: Building aarch64 binary
|
|
||||||
# steps:
|
|
||||||
# - name: Checking out buildscript
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
# with:
|
|
||||||
# sparse-checkout: |
|
|
||||||
# aarch64_buildscript
|
|
||||||
# sparse-checkout-cone-mode: false
|
|
||||||
# - name: Installing Packages
|
|
||||||
# run: |
|
|
||||||
# sudo apt -qq update -y > /dev/null
|
|
||||||
# sudo apt -y -qq install binfmt-support qemu-user-static systemd-container wget > /dev/null
|
|
||||||
# - name: Starting Services
|
|
||||||
# run: |
|
|
||||||
# sudo systemctl restart systemd-binfmt
|
|
||||||
# sudo systemctl start systemd-resolved
|
|
||||||
# - name: Downloading Arch Linux Arm Tarball for rpi4 aarch64
|
|
||||||
# run: |
|
|
||||||
# wget -q http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
|
|
||||||
# - name: Extracting Tarball
|
|
||||||
# run: |
|
|
||||||
# mkdir root
|
|
||||||
# sudo tar xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root --warning=no-unknown-keyword
|
|
||||||
# - name: Building Swingmusic in qemu
|
|
||||||
# run: |
|
|
||||||
# chmod +x aarch64_buildscript
|
|
||||||
# sed -i -e 's/TAG/${{ github.event.inputs.tag }}/g' aarch64_buildscript
|
|
||||||
# mv aarch64_buildscript root/
|
|
||||||
# sudo systemd-nspawn --bind-ro=/etc/resolv.conf -D root ./aarch64_buildscript
|
|
||||||
# - name: Upload aarch64 binary
|
|
||||||
# uses: actions/upload-artifact@v4
|
|
||||||
# with:
|
|
||||||
# name: arm64
|
|
||||||
# path: root/swingmusicbuilder/swingmusic/dist/swingmusic_linux_arm64
|
|
||||||
# retention-days: 1
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Create New Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# if: false
|
|
||||||
needs: [build]
|
|
||||||
permissions: write-all
|
|
||||||
steps:
|
|
||||||
- name: Checkout into repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Download all binaries
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
- name: Upload binaries to GitHub Release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
|
||||||
allowUpdates: true
|
|
||||||
artifacts: "./linux-amd64/swingmusic_linux_amd64, ./win-amd64/swingmusic.exe, ./macos-amd64/swingmusic_macos_amd64, ./macos-arm64/swingmusic_macos_arm64"
|
|
||||||
# artifacts: "./linux/swingmusic_linux_amd64, ./win32/swingmusic.exe, ./arm64/swingmusic_linux_arm64"
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
tag: ${{ format('v{0}',inputs.tag) }}
|
|
||||||
commit: ${{ github.sha }}
|
|
||||||
draft: ${{ inputs.is_draft }}
|
|
||||||
artifactErrorsFailBuild: true
|
|
||||||
name: ${{ format('v{0}',inputs.tag) }}
|
|
||||||
bodyFile: .github/changelog.md
|
|
||||||
makeLatest: ${{ inputs.is_latest }}
|
|
||||||
docker:
|
|
||||||
name: Build and push Docker image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions: write-all
|
|
||||||
if: inputs.build_docker == 'true'
|
|
||||||
# if: false
|
|
||||||
steps:
|
|
||||||
- name: Checkout into repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
# - name: Download linux binary
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: linux
|
|
||||||
# path: dist
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta # you'll use this in the next step
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64, linux/arm64 #,linux/arm
|
|
||||||
push: true
|
|
||||||
tags: ghcr.io/${{github.repository}}:${{format('v{0}', inputs.tag)}}, ${{env.LATEST_TAG}}
|
|
||||||
labels: org.opencontainers.image.title=Docker
|
|
||||||
build-args: |
|
|
||||||
app_version=${{inputs.tag}}
|
|
||||||
env:
|
|
||||||
LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
|
|
||||||
Reference in New Issue
Block a user