mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
ci/cd
This commit is contained in:
@@ -15,71 +15,76 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: Test Suite
|
name: Test Suite
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies (ubuntu)
|
- name: Install dependencies (ubuntu)
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
|
||||||
- name: Rust setup
|
- name: Rust setup
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: "swingmusic-desktop -> target"
|
workspaces: "swingmusic-desktop -> target"
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
run: npm install -g @tauri-apps/cli
|
run: npm install -g @tauri-apps/cli
|
||||||
|
|
||||||
- name: Install desktop dependencies
|
- name: Install desktop dependencies
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cd swingmusic-desktop && cargo test
|
run: cd swingmusic-desktop && cargo test
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
name: Build Linux
|
name: Build Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
needs: test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
|
||||||
- name: Rust setup
|
- name: Rust setup
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: x86_64-unknown-linux-gnu
|
targets: x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: "swingmusic-desktop -> target"
|
workspaces: "swingmusic-desktop -> target"
|
||||||
key: linux-x64
|
key: linux-x64
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
run: npm install -g @tauri-apps/cli
|
run: npm install -g @tauri-apps/cli
|
||||||
|
|
||||||
- name: Install desktop dependencies
|
- name: Install desktop dependencies
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
- name: Install webclient dependencies
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient
|
||||||
|
npm install
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm run tauri build -- --target x86_64-unknown-linux-gnu
|
npm run tauri build -- --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -88,39 +93,44 @@ jobs:
|
|||||||
swingmusic-desktop/target/x86_64-unknown-linux-gnu/release/bundle/
|
swingmusic-desktop/target/x86_64-unknown-linux-gnu/release/bundle/
|
||||||
!swingmusic-desktop/target/x86_64-unknown-linux-gnu/release/bundle/.*/
|
!swingmusic-desktop/target/x86_64-unknown-linux-gnu/release/bundle/.*/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: Build Windows
|
name: Build Windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: test
|
needs: test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Rust setup
|
- name: Rust setup
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: x86_64-pc-windows-msvc
|
targets: x86_64-pc-windows-msvc
|
||||||
|
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: "swingmusic-desktop -> target"
|
workspaces: "swingmusic-desktop -> target"
|
||||||
key: windows-x64
|
key: windows-x64
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
run: npm install -g @tauri-apps/cli
|
run: npm install -g @tauri-apps/cli
|
||||||
|
|
||||||
- name: Install desktop dependencies
|
- name: Install desktop dependencies
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
- name: Install webclient dependencies
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient
|
||||||
|
npm install
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm run tauri build -- --target x86_64-pc-windows-msvc
|
npm run tauri build -- --target x86_64-pc-windows-msvc
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -129,39 +139,44 @@ jobs:
|
|||||||
swingmusic-desktop/target/x86_64-pc-windows-msvc/release/bundle/
|
swingmusic-desktop/target/x86_64-pc-windows-msvc/release/bundle/
|
||||||
!swingmusic-desktop/target/x86_64-pc-windows-msvc/release/bundle/.*/
|
!swingmusic-desktop/target/x86_64-pc-windows-msvc/release/bundle/.*/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
name: Build macOS
|
name: Build macOS
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
needs: test
|
needs: test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Rust setup
|
- name: Rust setup
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: x86_64-apple-darwin
|
targets: x86_64-apple-darwin
|
||||||
|
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: "swingmusic-desktop -> target"
|
workspaces: "swingmusic-desktop -> target"
|
||||||
key: macos-x64
|
key: macos-x64
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
run: npm install -g @tauri-apps/cli
|
run: npm install -g @tauri-apps/cli
|
||||||
|
|
||||||
- name: Install desktop dependencies
|
- name: Install desktop dependencies
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
- name: Install webclient dependencies
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient
|
||||||
|
npm install
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm run tauri build -- --target x86_64-apple-darwin
|
npm run tauri build -- --target x86_64-apple-darwin
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -211,6 +211,11 @@ jobs:
|
|||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
- name: Install webclient dependencies
|
||||||
|
run: |
|
||||||
|
cd swingmusic-webclient
|
||||||
|
npm install
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
run: |
|
run: |
|
||||||
cd swingmusic-desktop
|
cd swingmusic-desktop
|
||||||
@@ -303,7 +308,7 @@ jobs:
|
|||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
else
|
else
|
||||||
VERSION=$(python -c "import sys; sys.path.insert(0, 'src'); from swingmusic import __version__; print(__version__)")
|
VERSION=$(python3 -c "import sys; sys.path.insert(0, 'src'); from swingmusic import __version__; print(__version__)")
|
||||||
VERSION="$VERSION-${{ github.run_number }}"
|
VERSION="$VERSION-${{ github.run_number }}"
|
||||||
fi
|
fi
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import os
|
||||||
|
from importlib import metadata as importlib_metadata
|
||||||
|
|
||||||
|
try:
|
||||||
|
__version__ = importlib_metadata.version("swingmusic")
|
||||||
|
except importlib_metadata.PackageNotFoundError:
|
||||||
|
# fallback to version.txt
|
||||||
|
version_file = os.path.join(os.path.dirname(__file__), "..", "..", "version.txt")
|
||||||
|
with open(version_file, "r") as f:
|
||||||
|
__version__ = f.read().strip()
|
||||||
Reference in New Issue
Block a user