spacedrive/.github/workflows/ci.yml
Vítor Vasconcellos bd0a7ff434
[ENG-265] Improve setup scripts (#1368)
* Setup script revamp

* Move toml to dev dep + CI runs the postinstall in debug mode

* Fix windows CI

* chmod +x scripts/setup.sh

* Fix eslint and ts CI

* Remove binstall + Fix trying to read input in CI

* Doesn't need to check pnpm and rust in CI

* Run postinstall script for Clippy CI

* Attempt to fix windows CI not running postinstall
 - Ignore cache when running postinstall on CI

* commited generated config.toml by mistake

* Pass GITHUB_TOKEN to `pnpm i`

* Update archive-wasm + Increase minimum node version to 18.17

* CI: Move rust setup after post-install script

* Revert: CI: Move rust setup after post-install script

* Fix CI, generate dummy cargo config.toml to fix prisma generation

* Fix windows CI

* CI: Fix wrong command

---------

Co-authored-by: Utku <74243531+utkubakir@users.noreply.github.com>
2023-09-28 10:03:46 +00:00

180 lines
4.8 KiB
YAML

name: CI
on:
pull_request:
merge_group:
env:
SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends
# Cancel previous runs of the same workflow on the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
typescript:
name: TypeScript
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js, pnpm and dependencies
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignorePostInstall: true
- name: Perform typechecks
run: pnpm typecheck
eslint:
name: ESLint
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js, pnpm and dependencies
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
ignorePostInstall: true
- name: Perform linting
run: pnpm lint
rustfmt:
name: Rust Formatting
runs-on: ubuntu-20.04
steps:
- name: Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout repository
uses: actions/checkout@v3
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\spacedrive_target
New-Item -Path target -ItemType Junction -Value C:\spacedrive_target
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
changes:
- 'apps/cli/*/**'
- 'apps/desktop/crates/*/**'
- 'apps/desktop/src-tauri/*/**'
- 'apps/mobile/crates/*/**'
- 'apps/server/*/**'
- 'core/**'
- 'crates/*/**'
- 'extensions/*/**'
- 'Cargo.toml'
- 'Cargo.lock'
- name: Setup Rust and Prisma
if: steps.filter.outputs.changes == 'true'
uses: ./.github/actions/setup-rust
- name: Run rustfmt
if: steps.filter.outputs.changes == 'true'
run: cargo fmt --all -- --check
clippy:
name: Clippy (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-20.04, macos-latest, windows-latest]
steps:
- name: Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout repository
uses: actions/checkout@v3
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\spacedrive_target
New-Item -Path target -ItemType Junction -Value C:\spacedrive_target
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
changes:
- 'apps/cli/*/**'
- 'apps/desktop/crates/*/**'
- 'apps/desktop/src-tauri/*/**'
- 'apps/mobile/crates/*/**'
- 'apps/server/*/**'
- 'core/**'
- 'crates/*/**'
- 'extensions/*/**'
- 'Cargo.toml'
- 'Cargo.lock'
- name: Setup System and Rust
if: steps.filter.outputs.changes == 'true'
uses: ./.github/actions/setup-system
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup shared libraries
if: steps.filter.outputs.changes == 'true'
env:
NODE_ENV: debug
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pushd ..
npm i archive-wasm mustache
popd
node scripts/post-install.mjs
- name: Run Clippy
if: steps.filter.outputs.changes == 'true'
uses: actions-rs/clippy-check@v1
with:
args: --workspace --all-features
token: ${{ secrets.GITHUB_TOKEN }}
# test:
# name: Test (${{ matrix.platform }})
# runs-on: ${{ matrix.platform }}
# strategy:
# matrix:
# platform: [ubuntu-20.04, macos-latest, windows-latest]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Setup
# uses: ./.github/actions/setup
#
# - name: Test
# run: cargo test --workspace --all-features