You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mediarepo/.github/workflows/build.yml

162 lines
3.7 KiB
YAML

name: Build and test
on:
workflow_dispatch:
push:
branches: [ main, gh-actions ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build-api:
defaults:
run:
shell: bash
working-directory: mediarepo-api
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
if: ${{ !env.ACT }}
- name: Cache build data
if: ${{ !env.ACT }}
uses: actions/cache@v2
with:
path: |
target
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install OS-specific dependencies
uses: knicknic/os-specific-run@v1.0.3
with:
linux: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y
- name: Build
run: cargo build --verbose
- name: Build API
run: cargo build --features=client-api --verbose
- name: Build Plugin
run: cargo build --features=tauri-plugin --verbose
- name: Test
run: cargo test --all-features
build-daemon:
# to run fewer steps in parallel
needs: build-api
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
if: ${{ !env.ACT }}
- name: Cache build data
if: ${{ !env.ACT }}
uses: actions/cache@v2
with:
path: |
target
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '^3.7'
- name: Build
run: python build.py build --daemon --verbose
- name: Upload artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v2
with:
name: mediarepo-daemon-${{ runner.os }}
path: |
out/*
build-ui:
# to run fewer steps in parallel
needs: build-api
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
if: ${{ !env.ACT }}
- name: Cache Dependencies
if: ${{ !env.ACT }}
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
node_modules
src-tauri/target
/home/runner/.cargo
~/.cargo
key: ${{ runner.os }}-release-dependencies-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-release-dependencies-
${{ runner.os }}-dependencies-
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '^3.7'
- name: Install OS-specific dependencies
uses: knicknic/os-specific-run@v1.0.3
with:
linux: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y
- name: Build project
run: python build.py build --ui --verbose
- name: Upload artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v2
with:
name: mediarepo-ui-${{ runner.os }}-release
path: |
out/*