mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
update
This commit is contained in:
@@ -14,8 +14,8 @@ This repository uses a unified CI/CD system that builds all components from the
|
|||||||
### 1. Unified Build (`unified-build.yml`)
|
### 1. Unified Build (`unified-build.yml`)
|
||||||
|
|
||||||
This is the main workflow that builds all components. It runs on:
|
This is the main workflow that builds all components. It runs on:
|
||||||
- Push to main/master/develop branches
|
- Push to any branch
|
||||||
- Pull requests to main/master/develop
|
- Pull requests from any branch
|
||||||
- Tags (for releases)
|
- Tags (for releases)
|
||||||
- Manual dispatch
|
- Manual dispatch
|
||||||
|
|
||||||
@@ -46,13 +46,7 @@ Lightweight testing workflow for development. Runs on:
|
|||||||
- Tests individual components without full builds
|
- Tests individual components without full builds
|
||||||
- Runs linting, unit tests, and basic build checks
|
- Runs linting, unit tests, and basic build checks
|
||||||
|
|
||||||
### 3. Backend and Docker Build (`build-and-deploy.yml`)
|
### 3. Desktop CI (`desktop-ci.yml`)
|
||||||
|
|
||||||
Simplified backup workflow focused only on:
|
|
||||||
- Backend Python package building
|
|
||||||
- Docker image creation
|
|
||||||
|
|
||||||
### 4. Desktop CI (`desktop-ci.yml`)
|
|
||||||
|
|
||||||
Legacy desktop-specific workflow (kept for compatibility).
|
Legacy desktop-specific workflow (kept for compatibility).
|
||||||
|
|
||||||
|
|||||||
@@ -1,235 +0,0 @@
|
|||||||
name: Backend and Docker Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
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 repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- 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
|
|
||||||
@@ -3,16 +3,12 @@ name: Unified Build and Deploy
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- '**'
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- '**'
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
force_release:
|
force_release:
|
||||||
|
|||||||
+1
-1
Submodule swingmusic-desktop updated: 84a76084f0...d6a0172c2d
Reference in New Issue
Block a user