mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
SEL-56: Setup Yarn Workspaces (#584)
This commit is contained in:
10
.github/workflows/app.yml
vendored
10
.github/workflows/app.yml
vendored
@@ -3,6 +3,7 @@ name: App CI
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "common/**"
|
||||
- "app/**"
|
||||
- ".github/workflows/app.yml"
|
||||
- ".github/actions/**"
|
||||
@@ -14,8 +15,6 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
with:
|
||||
working_directory: ./app
|
||||
- name: Run linter
|
||||
run: yarn lint
|
||||
working-directory: ./app
|
||||
@@ -29,10 +28,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
with:
|
||||
working_directory: ./app
|
||||
- name: Install app dependencies
|
||||
run: yarn install-app
|
||||
|
||||
- name: Build
|
||||
run: yarn build:deps
|
||||
working-directory: ./app
|
||||
- name: Test
|
||||
run: yarn test
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: OpenPassport CI/CD
|
||||
name: Self Circuits CI/CD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -50,21 +50,19 @@ jobs:
|
||||
|
||||
- name: Print Circom version
|
||||
run: circom --version
|
||||
|
||||
- name: "enable yarn"
|
||||
run: corepack enable yarn
|
||||
- name: Install Yarn dependencies
|
||||
working-directory: ./circuits
|
||||
run: yarn install-circuits --immutable
|
||||
run: yarn workspaces focus @selfxyz/circuits
|
||||
|
||||
- name: Run lint
|
||||
working-directory: ./circuits
|
||||
run: yarn lint
|
||||
|
||||
- name: Build (Circuits + Self dependencies)
|
||||
run: yarn build:deps
|
||||
working-directory: ./circuits
|
||||
- name: Run Tests (Circuits)
|
||||
working-directory: ./circuits
|
||||
env:
|
||||
FULL_TEST_SUITE: false
|
||||
run: yarn test
|
||||
|
||||
- name: Run Tests (Common)
|
||||
working-directory: ./common
|
||||
run: yarn test
|
||||
41
.github/workflows/contracts.yml
vendored
Normal file
41
.github/workflows/contracts.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Self Contracts CI/CD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
paths:
|
||||
- 'contracts/**'
|
||||
- 'common/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
paths:
|
||||
- 'contracts/**'
|
||||
- 'common/**'
|
||||
jobs:
|
||||
test_contracts:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ubuntu-latest
|
||||
environment: development
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set Node.js 20.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build Common Dependencies
|
||||
run: yarn workspace @selfxyz/common build
|
||||
- name: Build Contracts)
|
||||
run: yarn build
|
||||
working-directory: ./contracts
|
||||
- name: Run Tests (Contracts)
|
||||
working-directory: ./contracts
|
||||
# skip until they get fixed
|
||||
if: false
|
||||
run: yarn test
|
||||
34
.github/workflows/general-checks.yml
vendored
Normal file
34
.github/workflows/general-checks.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: General Self CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Run linter
|
||||
run: yarn lint
|
||||
|
||||
type-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build dependencies
|
||||
shell: bash
|
||||
run: yarn types
|
||||
test-common:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build dependencies
|
||||
shell: bash
|
||||
run: yarn workspace @selfxyz/common build
|
||||
- name: Run @selfxyz/common tests
|
||||
run: yarn workspace @selfxyz/common test
|
||||
85
.github/workflows/npm-publish.yml
vendored
85
.github/workflows/npm-publish.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
paths:
|
||||
- 'sdk/core/package.json'
|
||||
- 'sdk/qrcode/package.json'
|
||||
- 'common/package.json'
|
||||
|
||||
jobs:
|
||||
detect-changes:
|
||||
@@ -14,54 +15,55 @@ jobs:
|
||||
outputs:
|
||||
core_changed: ${{ steps.check-version.outputs.core_changed }}
|
||||
qrcode_changed: ${{ steps.check-version.outputs.qrcode_changed }}
|
||||
common_changed: ${{ steps.check-version.outputs.common_changed }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
|
||||
- name: Check for version changes
|
||||
id: check-version
|
||||
run: |
|
||||
git diff HEAD^ HEAD --name-only | grep -q "sdk/core/package.json" && echo "core_changed=true" >> $GITHUB_OUTPUT || echo "core_changed=false" >> $GITHUB_OUTPUT
|
||||
git diff HEAD^ HEAD --name-only | grep -q "sdk/qrcode/package.json" && echo "qrcode_changed=true" >> $GITHUB_OUTPUT || echo "qrcode_changed=false" >> $GITHUB_OUTPUT
|
||||
|
||||
git diff HEAD^ HEAD --name-only | grep -q "common/package.json" && echo "common_changed=true" >> $GITHUB_OUTPUT || echo "common_changed=false" >> $GITHUB_OUTPUT
|
||||
|
||||
if git diff HEAD^ HEAD -- sdk/core/package.json | grep -q '"version":'; then
|
||||
echo "core_changed=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
|
||||
if git diff HEAD^ HEAD -- sdk/qrcode/package.json | grep -q '"version":'; then
|
||||
echo "qrcode_changed=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
if git diff HEAD^ HEAD -- common/package.json | grep -q '"version":'; then
|
||||
echo "common_changed=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
publish-core:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.core_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies (common first)
|
||||
run: |
|
||||
cd common
|
||||
yarn install
|
||||
cd ../sdk/core
|
||||
yarn install
|
||||
|
||||
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
cd sdk/core
|
||||
yarn build
|
||||
|
||||
yarn workspace @selfxyz/core build:deps
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: sdk/core
|
||||
run: |
|
||||
cd sdk/core
|
||||
npm publish --access public
|
||||
yarn npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
@@ -71,28 +73,49 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies (common first)
|
||||
run: |
|
||||
cd common
|
||||
yarn install
|
||||
cd ../sdk/qrcode
|
||||
yarn install
|
||||
|
||||
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
cd sdk/qrcode
|
||||
yarn build
|
||||
|
||||
yarn workspace @sdk/qrcode build:deps
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: sdk/qrcode
|
||||
run: |
|
||||
cd sdk/qrcode
|
||||
npm publish --access public
|
||||
yarn npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
publish-common:
|
||||
needs: detect-changes
|
||||
if: needs.detect-changes.outputs.common_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
yarn workspace @selfxyz/common build
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: common
|
||||
run: |
|
||||
yarn npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user