diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70f41327..efd1cc24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Squiggle packages check +name: Squiggle packages checks on: push: @@ -9,217 +9,23 @@ on: branches: - master - develop - - reducer-dev - - epic-reducer-project - - epic-0.5.0 + +env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: quantified-uncertainty jobs: - pre_check: - name: Precheck for skipping redundant jobs + build-check-coverage: + name: Build, check, coverage runs-on: ubuntu-latest - outputs: - should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }} - should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }} - should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }} - should_skip_vscodeext: ${{ steps.skip_vscodeext_check.outputs.should_skip }} - should_skip_cli: ${{ steps.skip_cli_check.outputs.should_skip }} - steps: - - id: skip_lang_check - name: Check if the changes are about squiggle-lang src files - uses: fkirc/skip-duplicate-actions@v5.2.0 - with: - paths: '["packages/squiggle-lang/**"]' - - id: skip_components_check - name: Check if the changes are about components src files - uses: fkirc/skip-duplicate-actions@v5.2.0 - with: - paths: '["packages/components/**"]' - - id: skip_website_check - name: Check if the changes are about website src files - uses: fkirc/skip-duplicate-actions@v5.2.0 - with: - paths: '["packages/website/**"]' - - id: skip_vscodeext_check - name: Check if the changes are about vscode extension src files - uses: fkirc/skip-duplicate-actions@v5.2.0 - with: - paths: '["packages/vscode-ext/**"]' - - id: skip_cli_check - name: Check if the changes are about cli src files - uses: fkirc/skip-duplicate-actions@v5.2.0 - with: - paths: '["packages/cli/**"]' - - lang-lint: - name: Language lint - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/squiggle-lang steps: - uses: actions/checkout@v3 - - name: Install Dependencies - run: cd ../../ && yarn - - name: Check rescript lint - run: yarn lint:rescript - - name: Check javascript, typescript, and markdown lint - uses: creyD/prettier_action@v4.2 + - name: Setup Node.js environment + uses: actions/setup-node@v2 with: - dry: true - prettier_options: --check packages/squiggle-lang - - lang-build-test-bundle: - name: Language build, test, and bundle - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/squiggle-lang - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: Install dependencies from monorepo level - run: cd ../../ && yarn - - name: Build rescript codebase - run: yarn build - - name: Run rescript tests - run: yarn test:rescript - - name: Run typescript tests - run: yarn test:ts - - name: Run webpack - run: yarn bundle - - name: Upload rescript coverage report - run: yarn coverage:rescript:ci - - name: Upload typescript coverage report - run: yarn coverage:ts:ci - - components-lint: - name: Components lint - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/components - steps: - - uses: actions/checkout@v3 - - name: Check javascript, typescript, and markdown lint - uses: creyD/prettier_action@v4.2 - with: - dry: true - prettier_options: --check packages/components --ignore-path packages/components/.prettierignore - - components-bundle-build-test: - name: Components bundle, build and test - runs-on: ubuntu-latest - needs: pre_check - if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} - defaults: - run: - shell: bash - working-directory: packages/components - steps: - - uses: actions/checkout@v3 - - name: Install dependencies from monorepo level - run: cd ../../ && yarn - - name: Build rescript codebase in squiggle-lang - run: cd ../squiggle-lang && yarn build - - name: Run webpack - run: yarn bundle - - name: Build storybook - run: yarn build - - name: Test components - run: yarn test - - website-lint: - name: Website lint - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/website - steps: - - uses: actions/checkout@v3 - - name: Check javascript, typescript, and markdown lint - uses: creyD/prettier_action@v4.2 - with: - dry: true - prettier_options: --check packages/website - - website-build: - name: Website build - runs-on: ubuntu-latest - needs: pre_check - if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }} - defaults: - run: - shell: bash - working-directory: packages/website - steps: - - uses: actions/checkout@v3 - - name: Install dependencies from monorepo level - run: cd ../../ && yarn - - name: Build rescript in squiggle-lang - run: cd ../squiggle-lang && yarn build - - name: Build components - run: cd ../components && yarn build - - name: Build website assets - run: yarn build - - vscode-ext-lint: - name: VS Code extension lint - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/vscode-ext - steps: - - uses: actions/checkout@v3 - - name: Check javascript, typescript, and markdown lint - uses: creyD/prettier_action@v4.2 - with: - dry: true - prettier_options: --check packages/vscode-ext - - vscode-ext-build: - name: VS Code extension build - runs-on: ubuntu-latest - needs: pre_check - if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} || (needs.pre_check.outputs.should_skip_vscodeext != 'true') }} - defaults: - run: - shell: bash - working-directory: packages/vscode-ext - steps: - - uses: actions/checkout@v3 - - name: Install dependencies from monorepo level - run: cd ../../ && yarn - - name: Build - run: yarn compile - cli-lint: - name: CLI lint - runs-on: ubuntu-latest - needs: pre_check - if: ${{ needs.pre_check.outputs.should_skip_cli != 'true' }} - defaults: - run: - shell: bash - working-directory: packages/cli - steps: - - uses: actions/checkout@v3 - - name: Check javascript, typescript, and markdown lint - uses: creyD/prettier_action@v4.2 - with: - dry: true - prettier_options: --check packages/cli + node-version: 16 + cache: 'yarn' + - name: Turbo run + run: turbo run build test lint bundle + - name: Coverage + run: turbo run coverage --no-cache # coverage builds for squiggle-lang can generate slower code that should never be cached diff --git a/package.json b/package.json index 2db44f0c..f1241ebe 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,7 @@ "private": true, "name": "squiggle", "scripts": { - "nodeclean": "rm -r node_modules && rm -r packages/*/node_modules", - "format:all": "prettier --write . && cd packages/squiggle-lang && yarn format", - "lint:all": "prettier --check . && cd packages/squiggle-lang && yarn lint:rescript" + "nodeclean": "rm -r node_modules && rm -r packages/*/node_modules" }, "devDependencies": { "prettier": "^2.7.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index dca34532..92a088f0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -7,7 +7,9 @@ "bin": "index.js", "type": "module", "scripts": { - "start": "node ." + "start": "node .", + "lint": "prettier --check .", + "format": "prettier --write ." }, "license": "MIT", "dependencies": { diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json index 13058dfb..497b803c 100644 --- a/packages/squiggle-lang/package.json +++ b/packages/squiggle-lang/package.json @@ -22,10 +22,12 @@ "test:rescript": "jest --modulePathIgnorePatterns=__tests__/TS/*", "test:watch": "jest --watchAll", "test:fnRegistry": "jest __tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.bs.js", - "coverage:rescript": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html", - "coverage:ts": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts", - "coverage:rescript:ci": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov", - "coverage:ts:ci": "yarn coverage:ts && codecov", + "coverage:rescript:local": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html", + "coverage:ts:local": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts", + "coverage:rescript": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov", + "coverage:ts": "yarn coverage:ts && codecov", + "coverage": "yarn coverage:rescript && yarn coverage:ts", + "coverage:local": "yarn coverage:rescript:local && yarn coverage:ts:local", "lint:rescript": "./lint.sh", "lint:prettier": "prettier --check .", "lint": "yarn lint:rescript && yarn lint:prettier", diff --git a/turbo.json b/turbo.json index 3417e170..a7dabfa3 100644 --- a/turbo.json +++ b/turbo.json @@ -2,14 +2,19 @@ "$schema": "https://turborepo.org/schema.json", "pipeline": { "lint": {}, + "format": {}, "build": { "dependsOn": ["^build"] }, "test": { "dependsOn": ["build"] }, + "bundle": { + "dependsOn": ["^build", "build"] + }, "vscode-ext#build": { "dependsOn": ["^build", "@quri/squiggle-components#bundle"] - } + }, + "coverage": {} } }