aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorPauline <git@ethanlibs.co>2023-10-14 22:27:27 -0400
committerPauline <git@ethanlibs.co>2023-10-14 22:27:27 -0400
commit2582162cea2b3a59cd21c78f8b73cb03d0acad40 (patch)
tree432057475f3b51850a85e2cba9969bcb79f3a8e6 /.github/workflows
parent06f51ccdc496a6581d098edc424f3973e550221d (diff)
downloadNexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.tar.gz
Nexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.tar.bz2
Nexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.zip
refactor(trunk): refactor the entire project idk
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/cache-factory.yaml77
-rw-r--r--.github/workflows/release.yaml102
-rw-r--r--.github/workflows/testing.yaml142
3 files changed, 321 insertions, 0 deletions
diff --git a/.github/workflows/cache-factory.yaml b/.github/workflows/cache-factory.yaml
new file mode 100644
index 0000000..d2535ab
--- /dev/null
+++ b/.github/workflows/cache-factory.yaml
@@ -0,0 +1,77 @@
+# This workflow _produces_ caches which are used to speed up pull request builds.
+# Originally from https://github.com/libp2p/rust-libp2p/blob/master/.github/workflows/cache-factory.yml
+
+name: Cache Factory
+
+on:
+ push:
+ paths:
+ - 'Cargo.lock'
+ - './scripts/setup.sh'
+ - './scripts/setup.ps1'
+ - '.github/workflows/cache-factory.yaml'
+ - '.github/actions/**/*.yml'
+ - '.github/actions/**/*.yaml'
+ - '**/build.rs'
+ - 'core/prisma/**'
+ branches:
+ - main
+
+# Cancel previous runs of the same workflow on the same branch.
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ make_cache:
+ strategy:
+ fail-fast: true
+ matrix:
+ settings:
+ - host: macos-latest
+ target: x86_64-apple-darwin
+ - host: macos-latest
+ target: aarch64-apple-darwin
+ - host: windows-latest
+ target: x86_64-pc-windows-msvc
+ - host: ubuntu-20.04
+ target: x86_64-unknown-linux-gnu
+ name: 'Make Cache'
+ runs-on: ${{ matrix.settings.host }}
+ 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:\nexus_target
+ New-Item -Path target -ItemType Junction -Value C:\nexus_target
+
+ - name: Setup System and Rust
+ uses: ./.github/actions/setup-system
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ target: ${{ matrix.settings.target }}
+ save-cache: 'true'
+
+ - name: Clippy
+ run: cargo clippy --workspace --all-features --target ${{ matrix.settings.target }}
+
+ - name: Compile (debug)
+ run: cargo test --workspace --all-features --no-run --target ${{ matrix.settings.target }}
+
+ - name: Compile (release)
+ run: cargo test --workspace --all-features --no-run --release --target ${{ matrix.settings.target }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..4fbdbcd
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,102 @@
+name: Release
+
+on:
+ workflow_dispatch:
+
+# a lot of this isnt necessary but i'm designing ahead for tauri integration
+jobs:
+ desktop-main:
+ strategy:
+ matrix:
+ settings:
+ - host: macos-latest
+ target: x86_64-apple-darwin
+ bundles: app,dmg
+ os: darwin
+ arch: x86_64
+ - host: macos-latest
+ target: aarch64-apple-darwin
+ bundles: app,dmg
+ os: darwin
+ arch: aarch64
+ - host: windows-latest
+ target: x86_64-pc-windows-msvc
+ bundles: msi
+ os: windows
+ arch: x86_64
+ - host: ubuntu-20.04
+ target: x86_64-unknown-linux-gnu
+ bundles: deb,appimage
+ os: linux
+ arch: x86_64
+ name: Desktop - Main ${{ matrix.settings.target }}
+ runs-on: ${{ matrix.settings.host }}
+ 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:\nexus_target
+ New-Item -Path target -ItemType Junction -Value C:\nexus_target
+
+ - name: Remove 32-bit libs
+ if: ${{ runner.os == 'Linux' }}
+ run: |
+ dpkg -l | grep i386
+ sudo apt-get purge --allow-remove-essential libc6-i386 ".*:i386"
+ sudo dpkg --remove-architecture i386
+
+ - name: Setup System and Rust
+ uses: ./.github/actions/setup-system
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ target: ${{ matrix.settings.target }}
+
+ - name: Setup Node.js, pnpm and dependencies
+ uses: ./.github/actions/setup-pnpm
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build
+ run: |
+ pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }},updater
+
+ # this doesnt work rn so just uhh dont use it lol
+ - name: Publish Artifacts
+ uses: ./.github/actions/publish-artifacts
+ with:
+ os: ${{ matrix.settings.os }}
+ arch: ${{ matrix.settings.arch }}
+ target: ${{ matrix.settings.target }}
+ profile: release
+
+ release:
+ if: startsWith(github.ref, 'refs/tags/')
+ runs-on: ubuntu-latest
+ name: Create Release
+ needs: desktop-main
+ permissions:
+ contents: write
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v3
+
+ - name: Create Release
+ uses: softprops/action-gh-release@v1
+ with:
+ draft: true
+ files: '*/**'
diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml
new file mode 100644
index 0000000..b92345c
--- /dev/null
+++ b/.github/workflows/testing.yaml
@@ -0,0 +1,142 @@
+name: CI
+
+on:
+ pull_request:
+ merge_group:
+
+# 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 }}
+
+ - 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 }}
+
+ - 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:\nexus_target
+ New-Item -Path target -ItemType Junction -Value C:\nexus_target
+
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ filters: |
+ changes:
+ - 'apps/cli/*/**'
+ - 'apps/desktop/crates/*/**'
+ - 'apps/desktop/src-tauri/*/**'
+ - 'core/**'
+ - 'crates/*/**'
+ - 'Cargo.toml'
+ - 'Cargo.lock'
+
+ - name: Setup Rust
+ 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:\nexus_target
+ New-Item -Path target -ItemType Junction -Value C:\nexus_target
+
+ - uses: dorny/paths-filter@v2
+ id: filter
+ with:
+ # this is also designing ahead for tauri
+ filters: |
+ changes:
+ - 'apps/cli/*/**'
+ - 'apps/desktop/crates/*/**'
+ - 'apps/desktop/src-tauri/*/**'
+ - 'core/**'
+ - 'crates/*/**'
+ - '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: Run Clippy
+ if: steps.filter.outputs.changes == 'true'
+ uses: actions-rs/clippy-check@v1
+ with:
+ args: --workspace --all-features
+ token: ${{ secrets.GITHUB_TOKEN }}