Skip to content

Reboot

Reboot #389

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
outputs:
filter: ${{ steps.filter.outputs.workflows }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: latest
- name: Install system dependencies # Pull this step from `oscartbeaumont/specta`
run: sudo apt-get update && sudo apt-get install librust-atk-dev libwebkit2gtk-4.0-dev build-essential libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Install npm dependencies
run: pnpm i --frozen-lockfile
# TODO: Enabling this breaks the CI build with SolidJS Typescript errors and I don't get it.
# - name: Build npm packages
# run: pnpm build
- name: Typecheck
run: pnpm typecheck
- name: Build Rust crate
run: cargo build --all-features
# - name: Generate test bindings for typecheck
# run: cargo test -p example tests::test_rspc_router -- --exact # TODO: Move this into a the first unit test
- name: Test Rust crate
run: cargo test --all --exclude create-rspc-app --all-features
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
workflows:
- 'packages/**'
build-publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: test
if: (github.event_name == 'workflow_dispatch' || (needs.test.outputs.filter == 'true' && github.event_name == 'push')) && github.repository == 'oscartbeaumont/rspc'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'pnpm'
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Build
run: pnpm build
- name: Configure main version
if: github.ref == 'refs/heads/main'
run: pnpm set-package-versions
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
- name: Publish main to npm
if: github.ref == 'refs/heads/main'
run: pnpm publish -r ${TAG} --no-git-checks --filter "@rspc/*" --access public
env:
TAG: ${{ (github.ref == 'refs/heads/main' && '--tag=main') || '' }}
# - name: Configure release version
# if: github.ref_type == 'tag'
# run: pnpm set-package-versions
# - name: Publish release to npm
# if: github.ref_type == 'tag'
# run: pnpm publish -r ${TAG} --no-git-checks --filter "@rspc/*" --access public
# env:
# TAG: ${{ (contains(github.ref_name, '-beta.') && '--tag=beta') || ''}}