ci: restore full GitHub Actions workflow with v4 actions and multi-OS matrix
This commit is contained in:
+81
-45
@@ -2,9 +2,9 @@ name: CI/CD
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, master ]
|
branches: [ main ]
|
||||||
release:
|
release:
|
||||||
types: [ created ]
|
types: [ created ]
|
||||||
|
|
||||||
@@ -14,23 +14,30 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
# Test job
|
# Test job
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test (${{ matrix.os }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
shell: bash
|
uses: dtolnay/rust-toolchain@stable
|
||||||
run: |
|
with:
|
||||||
if ! command -v rustup >/dev/null 2>&1; then
|
targets: ${{ matrix.target }}
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
||||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
fi
|
|
||||||
rustup toolchain install stable --profile minimal --target x86_64-unknown-linux-gnu
|
|
||||||
rustup default stable
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies (Linux)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
@@ -44,14 +51,15 @@ jobs:
|
|||||||
libasound2-dev
|
libasound2-dev
|
||||||
|
|
||||||
- name: Cache cargo
|
- name: Cache cargo
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
src/target
|
src/target
|
||||||
key: linux-cargo-${{ hashFiles('src/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||||
restore-keys: linux-cargo-
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
- name: Check
|
- name: Check
|
||||||
working-directory: src
|
working-directory: src
|
||||||
@@ -71,10 +79,10 @@ jobs:
|
|||||||
name: Build Frontend
|
name: Build Frontend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
|
||||||
@@ -87,31 +95,43 @@ jobs:
|
|||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Upload frontend artifact
|
- name: Upload frontend artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: frontend-dist
|
name: frontend-dist
|
||||||
path: src/tauri-app/frontend/dist/
|
path: src/tauri-app/frontend/dist/
|
||||||
|
|
||||||
# Build desktop app (Linux only)
|
# Build desktop apps
|
||||||
build-desktop:
|
build-desktop:
|
||||||
name: Build Desktop (Linux)
|
name: Build Desktop (${{ matrix.platform }})
|
||||||
needs: [test, build-frontend]
|
needs: [test, build-frontend]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
platform: linux
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
artifact: linux-amd64
|
||||||
|
- os: windows-latest
|
||||||
|
platform: windows
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
artifact: windows-amd64
|
||||||
|
- os: macos-latest
|
||||||
|
platform: macos
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
artifact: macos-amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
shell: bash
|
uses: dtolnay/rust-toolchain@stable
|
||||||
run: |
|
with:
|
||||||
if ! command -v rustup >/dev/null 2>&1; then
|
targets: ${{ matrix.target }}
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
||||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
fi
|
|
||||||
rustup toolchain install stable --profile minimal --target x86_64-unknown-linux-gnu
|
|
||||||
rustup default stable
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies (Linux)
|
||||||
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
@@ -125,36 +145,52 @@ jobs:
|
|||||||
libasound2-dev
|
libasound2-dev
|
||||||
|
|
||||||
- name: Download frontend artifact
|
- name: Download frontend artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: frontend-dist
|
name: frontend-dist
|
||||||
path: src/tauri-app/frontend/dist/
|
path: src/tauri-app/frontend/dist/
|
||||||
|
|
||||||
- name: Cache cargo
|
- name: Cache cargo
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
src/target
|
src/target
|
||||||
key: linux-cargo-${{ hashFiles('src/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||||
restore-keys: linux-cargo-
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: src
|
working-directory: src
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
|
|
||||||
- name: Package
|
- name: Package (Linux)
|
||||||
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
cp src/target/release/re-teamspeak dist/ || true
|
cp src/target/release/re-teamspeak dist/ || true
|
||||||
tar -czf re-teamspeak-linux-amd64.tar.gz -C dist .
|
tar -czf re-teamspeak-${{ matrix.artifact }}.tar.gz -C dist .
|
||||||
|
|
||||||
|
- name: Package (Windows)
|
||||||
|
if: matrix.platform == 'windows'
|
||||||
|
run: |
|
||||||
|
mkdir dist
|
||||||
|
copy src\target\release\re-teamspeak.exe dist\ || copy src\target\release\re_teamspeak.exe dist\ || echo "Binary not found"
|
||||||
|
Compress-Archive -Path dist\* -DestinationPath re-teamspeak-${{ matrix.artifact }}.zip
|
||||||
|
|
||||||
|
- name: Package (macOS)
|
||||||
|
if: matrix.platform == 'macos'
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
cp src/target/release/re-teamspeak dist/ || true
|
||||||
|
tar -czf re-teamspeak-${{ matrix.artifact }}.tar.gz -C dist .
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: re-teamspeak-linux-amd64
|
name: re-teamspeak-${{ matrix.artifact }}
|
||||||
path: re-teamspeak-linux-amd64.*
|
path: re-teamspeak-${{ matrix.artifact }}.*
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
release:
|
release:
|
||||||
@@ -167,7 +203,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifacts/
|
path: artifacts/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user