Skip to content

Commit

Permalink
misc dx + bring in ci (#80)
Browse files Browse the repository at this point in the history
* Update GHA CI build (#72)

* Update GHA CI build

* Update job for current directory structure

* reorg: prelude

* dx, factory pattern, ci

* bump prisma

* wip: dao

* oop

* oop?

Co-authored-by: Matt Boulanger <Celeo@users.noreply.github.com>
  • Loading branch information
aaronleopold and Celeo authored Oct 30, 2022
1 parent 54bd467 commit da3fe1b
Show file tree
Hide file tree
Showing 93 changed files with 1,767 additions and 568 deletions.
26 changes: 26 additions & 0 deletions .github/actions/pnpm-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PNPM Setup
description: Setup PNPM and cache PNPM dependencies
runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install dependencies
shell: bash
run: pnpm install
18 changes: 18 additions & 0 deletions .github/actions/prisma-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Prisma Setup
description: Generate/cache Prisma client
runs:
using: 'composite'
steps:
- name: Cache Prisma client
id: cache-prisma
uses: actions/cache@v3
with:
path: core/src/prisma.rs
# FIXME: maybe it is just `act`, but this keeps failing: An internal error has occurred in cache backend.
key: ${{ runner.os }}-prisma-${{ hashFiles('**/schema.prisma') }}

- name: Generate Prisma client
working-directory: core
if: steps.cache-prisma.outputs.cache-hit != 'true'
shell: bash
run: cargo run -p prisma --release -- generate
22 changes: 22 additions & 0 deletions .github/actions/rust-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust Setup
description: Generate/cache Rust dependencies and prisma client
runs:
using: 'composite'
steps:
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
88 changes: 88 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Stump-CI

on:
pull_request:
push:
branches:
- main

jobs:
check-rust:
name: Rust checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy

- name: System setup
run: CHECK_NODE=0 CHECK_CARGO=0 DEV_SETUP=0 ./scripts/system-setup.sh

- name: Setup rust
uses: ./.github/actions/rust-setup

- name: Setup prisma
uses: ./.github/actions/prisma-setup

- name: Run cargo checks
run: |
cargo fmt --all -- --check
cargo clippy -- -D warnings
# - name: Run tests
# run: |
# cargo integration-tests

check-typescript:
name: TypeScript checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14

- name: Setup pnpm and typescript
uses: ./.github/actions/pnpm-setup

- name: Run type checks
run: pnpm tsc:checks

# release:
# name: Release (${{ matrix.platform }})
# runs-on: ${{ matrix.platform }}
# # Release only runs on push to main. TODO: can I make this trigger on tag?
# if: github.event_name != 'pull_request'
# strategy:
# fail-fast: true
# matrix:
# platform: [ubuntu-latest, macos-latest, windows-latest]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# override: true
# # TODO: clippy??
# components: rustfmt, rust-src

# # TODO: figure out caching for rust deps

# - name: Generate Prisma client
# uses: ./.github/actions/generate-prisma-client

# TODO: pnpm setup
# TODO: docker builds -> maybe this helps? https://github.com/devture/matrix-corporal/blob/master/.gitlab-ci.yml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ node_modules
$houdini
*.log
.eslintcache
dist
**/dist/*
!**/dist/.placeholder
build

# rust
Expand Down
Loading

0 comments on commit da3fe1b

Please sign in to comment.