From 3600423f2b0ff76a95edf13a0ef135da8cface07 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 22 Apr 2022 18:22:53 +0800 Subject: [PATCH] actual new ci --- .github/workflows/_ci.yaml | 119 ----------------------- .github/workflows/ci.yaml | 189 +++++++++++++++++-------------------- 2 files changed, 88 insertions(+), 220 deletions(-) delete mode 100644 .github/workflows/_ci.yaml diff --git a/.github/workflows/_ci.yaml b/.github/workflows/_ci.yaml deleted file mode 100644 index 85fd03bf3..000000000 --- a/.github/workflows/_ci.yaml +++ /dev/null @@ -1,119 +0,0 @@ -name: CI -on: - pull_request: - push: - branches: - - main - - new-ci - paths-ignore: - - "**/.md" - workflow_dispatch: - -jobs: - build: - strategy: - fail-fast: false - matrix: - platform: [macos-latest, ubuntu-latest, windows-latest] - env: - FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z - RUST_CACHE_VERSION: 0 - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v2 - - # from https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml - - name: Install ffmpeg (Windows) - if: matrix.platform == 'windows-latest' - run: | - $VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) - Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" - Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z - 7z x ffmpeg-release-full-shared.7z - mkdir ffmpeg - mv ffmpeg-*/* ffmpeg/ - Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" - Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" - - - name: Install CMake (Windows) - uses: lukka/get-cmake@latest - if: matrix.platform == 'windows-latest' - - # Optimisation for windows - - name: Rename existing rust toolchain (Windows) - if: matrix.platform == 'windows-latest' - run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - components: rustfmt, rust-src - - - name: Cache Rust Dependencies - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c - with: - sharedKey: ${{ env.RUST_CACHE_VERSION }} - - - name: Cache pnpm dependencies - uses: actions/cache@v2 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- - - - name: Install pnpm - uses: pnpm/action-setup@v2.2.1 - with: - version: 6.32.6 - - - name: Install dependencies (Ubuntu) - if: matrix.platform == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - libgtk-3-dev \ - webkit2gtk-4.0 \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libssl-dev \ - libavcodec-dev \ - libavdevice-dev \ - libavfilter-dev \ - libavformat-dev \ - libavresample-dev \ - libavutil-dev \ - libswscale-dev \ - libswresample-dev \ - pkg-config \ - ffmpeg - - - name: Install dependencies (macOS) - if: matrix.platform == 'macos-latest' - run: | - brew install ffmpeg - - - name: Install pnpm dependencies - run: pnpm i - - - name: Build codegen - run: pnpm prep:ci - - - name: Build frontend - run: pnpm desktop build:vite - - - name: Build Tauri app - uses: tauri-apps/tauri-action@v0 - with: - projectPath: apps/desktop - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2d7d14b37..7e6a2dbe1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,115 +3,102 @@ on: pull_request: push: branches: - - main - - ci + - main + - new-ci + paths-ignore: + - '**/.md' workflow_dispatch: jobs: - build: + typescript: + name: TypeScript + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 17 + + - name: Cache pnpm dependencies + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + pnpm- + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.1 + with: + version: 6.32.6 + + - name: Install dependencies + run: pnpm i --frozen-lockfile + + - name: Perform typechecks + run: pnpm -r exec tsc + + build-js: + name: Build apps/${{ matrix.app }} JS + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + app: [desktop, web] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 17 + + - name: Cache pnpm dependencies + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + pnpm- + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.1 + with: + version: 6.32.6 + + - name: Install dependencies + run: pnpm i --frozen-lockfile + + - name: Build + run: pnpm --filter @sd/${{ matrix.app }} build + + build-core-pkgs: + name: Build core/${{ matrix.package }} strategy: fail-fast: false matrix: platform: [macos-latest, ubuntu-latest, windows-latest] - env: - FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z - RUST_CACHE_VERSION: 0 + package: [derive, prisma] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 - - # from https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml - - name: Install ffmpeg (Windows) - if: matrix.platform == 'windows-latest' - run: | - $VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) - Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" - Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z - 7z x ffmpeg-release-full-shared.7z - mkdir ffmpeg - mv ffmpeg-*/* ffmpeg/ - Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" - Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" - - - name: Install CMake (Windows) - uses: lukka/get-cmake@latest - if: matrix.platform == 'windows-latest' - - # Optimisation for windows - - name: Rename existing rust toolchain (Windows) - if: matrix.platform == 'windows-latest' - run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - components: rustfmt, rust-src - - - name: Cache Rust Dependencies - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c - with: - sharedKey: ${{ env.RUST_CACHE_VERSION }} - - - name: Cache pnpm dependencies - uses: actions/cache@v2 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- + - name: Checkout repository + uses: actions/checkout@v2 - - name: Install pnpm - uses: pnpm/action-setup@v2.2.1 - with: - version: 6.32.6 - - - name: Install dependencies (Ubuntu) - if: matrix.platform == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - libgtk-3-dev \ - webkit2gtk-4.0 \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libssl-dev \ - libavcodec-dev \ - libavdevice-dev \ - libavfilter-dev \ - libavformat-dev \ - libavresample-dev \ - libavutil-dev \ - libswscale-dev \ - libswresample-dev \ - pkg-config \ - ffmpeg - - - name: Install dependencies (macOS) - if: matrix.platform == 'macos-latest' - run: | - brew install ffmpeg - - - name: Install pnpm dependencies - run: pnpm i + - name: Install Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: rustfmt, rust-src + + - name: Cache Rust Dependencies + uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c - - name: Build codegen - run: pnpm prep:ci - - - name: Build frontend - run: pnpm desktop build:vite - - - name: Build Tauri app - uses: tauri-apps/tauri-action@v0 - with: - projectPath: apps/desktop - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - name: Build core/${{ matrix.package }} + working-directory: core/${{matrix.package}} + run: cargo build --release \ No newline at end of file