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:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
branches: [ main ]
|
||||
release:
|
||||
types: [ created ]
|
||||
|
||||
@@ -14,23 +14,30 @@ env:
|
||||
jobs:
|
||||
# Test job
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
name: Test (${{ matrix.os }})
|
||||
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:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup >/dev/null 2>&1; then
|
||||
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
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install system dependencies
|
||||
- name: Install system dependencies (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
@@ -44,14 +51,15 @@ jobs:
|
||||
libasound2-dev
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
src/target
|
||||
key: linux-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||
restore-keys: linux-cargo-
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-
|
||||
|
||||
- name: Check
|
||||
working-directory: src
|
||||
@@ -71,10 +79,10 @@ jobs:
|
||||
name: Build Frontend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
@@ -87,31 +95,43 @@ jobs:
|
||||
run: npm run build
|
||||
|
||||
- name: Upload frontend artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: src/tauri-app/frontend/dist/
|
||||
|
||||
# Build desktop app (Linux only)
|
||||
# Build desktop apps
|
||||
build-desktop:
|
||||
name: Build Desktop (Linux)
|
||||
name: Build Desktop (${{ matrix.platform }})
|
||||
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:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup >/dev/null 2>&1; then
|
||||
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
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install system dependencies
|
||||
- name: Install system dependencies (Linux)
|
||||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
@@ -125,36 +145,52 @@ jobs:
|
||||
libasound2-dev
|
||||
|
||||
- name: Download frontend artifact
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: src/tauri-app/frontend/dist/
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
src/target
|
||||
key: linux-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||
restore-keys: linux-cargo-
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-
|
||||
|
||||
- name: Build
|
||||
working-directory: src
|
||||
run: cargo build --release
|
||||
|
||||
- name: Package
|
||||
- name: Package (Linux)
|
||||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
mkdir -p dist
|
||||
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
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: re-teamspeak-linux-amd64
|
||||
path: re-teamspeak-linux-amd64.*
|
||||
name: re-teamspeak-${{ matrix.artifact }}
|
||||
path: re-teamspeak-${{ matrix.artifact }}.*
|
||||
|
||||
# Release
|
||||
release:
|
||||
@@ -167,7 +203,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user