Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple tiny hotfixes to opsy stuff #222

Merged
merged 34 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1478cc7
Update and rename ci.yaml to ci.yml
quinn-dougherty Apr 11, 2022
2c49d72
Update README.md
quinn-dougherty Apr 11, 2022
1c662be
Update developer-bug.md
quinn-dougherty Apr 11, 2022
5f4daae
added netlify badge for docs
quinn-dougherty Apr 11, 2022
66c91e4
Update CODEOWNERS
quinn-dougherty Apr 11, 2022
51e8033
Update README.md
quinn-dougherty Apr 11, 2022
8bab562
Update ci.yml
quinn-dougherty Apr 11, 2022
36fc47b
more netlify badges
quinn-dougherty Apr 11, 2022
c5341b6
`.tx` -> `ts`
quinn-dougherty Apr 11, 2022
2ee5105
Update README.md
quinn-dougherty Apr 11, 2022
b12f3f0
forgot to tag username in `.github/*`
quinn-dougherty Apr 11, 2022
e4e8e4b
ran `rescript format` on `ProgramEvaluator.res`
quinn-dougherty Apr 11, 2022
00e9876
a rescript linter!
quinn-dougherty Apr 11, 2022
518f082
(rebase): A rescript linter!
quinn-dougherty Apr 11, 2022
72dd99b
added lint to ci
quinn-dougherty Apr 11, 2022
7c27c0a
typo in ci.yml
quinn-dougherty Apr 11, 2022
d9d3f19
typos in ci.yml, more of them
quinn-dougherty Apr 11, 2022
97b7388
checking boolean expression syntax
quinn-dougherty Apr 11, 2022
4e93141
boolean expression testing
quinn-dougherty Apr 11, 2022
e3c6c0a
back to `not equal to true` syntax instead of `not`, :frown:
quinn-dougherty Apr 11, 2022
188e508
FOUND THE TYPO IT WAS `$` instead of `18826` lol
quinn-dougherty Apr 11, 2022
018c5f7
one last set of choices for ci.yml
quinn-dougherty Apr 11, 2022
efa832c
should trigger website job
quinn-dougherty Apr 11, 2022
983dc1f
demorgan's law
quinn-dougherty Apr 11, 2022
19d5fa1
`rescript format` on `DistPlus.res`
quinn-dougherty Apr 11, 2022
d4b00b1
debugging triggers again
quinn-dougherty Apr 11, 2022
3689caa
finally nailed the triggers! (I hope)
quinn-dougherty Apr 11, 2022
3f2cd65
path to rescript executable in lint.sh
quinn-dougherty Apr 11, 2022
9f97213
added deeper path in lint.sh
quinn-dougherty Apr 11, 2022
16258c2
install dependencies in lint job
quinn-dougherty Apr 11, 2022
af3cab0
added `.resi` files to lint checker
quinn-dougherty Apr 11, 2022
a498ed4
branch names in `*.yml`
quinn-dougherty Apr 11, 2022
a7df0bb
prettier jobs
quinn-dougherty Apr 11, 2022
c7908e8
prettier is proper now with yarn scripts
quinn-dougherty Apr 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@
# IMPORTANT NOTE: in order to actually get pinged, commit access is required.
# This also holds true for GitHub teams.

# This file
/.github/CODEOWNERS @quinn-dougherty

# Any rescript code
# Rescript
*.res @Hazelfire @OAGr @quinn-dougherty
*.resi @Hazelfire @OAGr @quinn-dougherty

# Any typescript code
# Typescript
*.tsx @Hazelfire @OAGr
*.ts @Hazelfire @OAGr

# Javascript
*.js @Hazelfire

# Any opsy files
.github/* @quinn-dougherty
*.json @quinn-dougherty @Hazelfire
*.y*ml @quinn-dougherty
*.config.js @Hazelfire

# Documentation
*.md @quinn-dougherty @OAGr @Hazelfire
*.mdx @quinn-dougherty @OAGr @Hazelfire
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/developer-bug.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Developer friction when contributing to Squiggle
about: Did your yarn scripts fail? Did the CI diverge from a README? Have a testing-related task? Etc.
about: Have a testing-related task? Did your yarn scripts fail? Did the CI diverge from a README? Etc.
labels: 'ops & testing'
---
# Description:
Expand Down
70 changes: 63 additions & 7 deletions .github/workflows/ci.yaml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Squiggle packages check

on:
push: # Delete this line if there becomes a scarcity of build minutes.
pull_request:
branches:
- master
- production
- staging
- develop

jobs:

Expand Down Expand Up @@ -33,8 +34,29 @@ jobs:
with:
paths: '["packages/website/**"]'

lang-build-test:
name: Language build and test
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@v2
- name: Install Dependencies
run: cd ../../ && yarn
- name: Check rescript lint
run: yarn lint:rescript
- name: Check javascript, typescript, and markdown lint
uses: creyD/[email protected]
with:
dry: true
prettier_options: --check .

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' }}
Expand All @@ -53,11 +75,28 @@ jobs:
- name: Run webpack
run: yarn bundle

components-build-test:
name: Components build and test
components-lint:
name: Components lint
runs-on: ubuntu-latest
needs: [pre_check]
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/components
steps:
- uses: actions/checkout@v2
- name: Check javascript, typescript, and markdown lint
uses: creyD/[email protected]
with:
dry: true
prettier_options: --check .

components-bundle-build:
name: Components bundle and 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') }}
defaults:
run:
shell: bash
Expand All @@ -73,11 +112,28 @@ jobs:
- name: Build storybook
run: yarn build

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@v2
- name: Check javascript, typescript, and markdown lint
uses: creyD/[email protected]
with:
dry: true
prettier_options: --check .

website-build:
name: Website build
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }}
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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ on:
push:
branches:
- master
- production
- staging
- develop
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- production
- staging
- develop
schedule:
- cron: '42 19 * * 0'

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Squiggle
![Packages check](https://github.com/QURIresearch/squiggle/actions/workflows/ci.yaml/badge.svg)
![Packages check](https://github.com/QURIresearch/squiggle/actions/workflows/ci.yml/badge.svg)
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-lang.svg)](https://www.npmjs.com/package/@quri/squiggle-lang)
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-components.svg)](https://www.npmjs.com/package/@quri/squiggle-components)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/QURIresearch/squiggle/blob/staging/LICENSE)

This is an experimental DSL/language for making probabilistic estimates. The full story can be found [here](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3).

## Our deployments

- **website/docs prod**: https://squiggle-language.com
- **website/docs prod**: https://squiggle-language.com [![Netlify Status](https://api.netlify.com/api/v1/badges/2139af5c-671d-473d-a9f6-66c96077d8a1/deploy-status)](https://app.netlify.com/sites/squiggle-documentation/deploys)
- **website/docs staging**: https://staging--squiggle-documentation.netlify.app/
- **old playground**: https://playground.squiggle-language.com
- **components storybook prod**: https://squiggle-components.netlify.app/ [![Netlify Status](https://api.netlify.com/api/v1/badges/b7f724aa-6b20-4d0e-bf86-3fcd1a3e9a70/deploy-status)](https://app.netlify.com/sites/squiggle-components/deploys)
- **components storybook staging**: https://staging--squiggle-components.netlify.app/
- **legacy (2020) playground**: https://playground.squiggle-language.com

## Packages
This monorepo has several packages that can be used for various purposes. All
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"scripts": {
"nodeclean": "rm -r node_modules && rm -r packages/*/node_modules"
},
"devDependencies": {
"prettier": "^2.6.2"
},
"workspaces": [
"packages/*"
],
Expand Down
5 changes: 3 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
"build": "tsc -b && build-storybook -s public",
"bundle": "webpack",
"all": "yarn bundle && yarn build"
"all": "yarn bundle && yarn build",
"lint": "prettier --check .",
"format": "prettier --write ."
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -76,7 +78,6 @@
"@storybook/preset-create-react-app": "^4.1.0",
"@storybook/react": "^6.4.20",
"@types/webpack": "^4.41.32",
"prettier": "^2.6.2",
"react-codejar": "^1.1.2",
"ts-loader": "^9.2.8",
"webpack": "^5.72.0",
Expand Down
41 changes: 41 additions & 0 deletions packages/squiggle-lang/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Hat tip to @dfalling
# https://forum.rescript-lang.org/t/rescript-9-1-how-can-we-format-to-standard-out/1590/2?u=quinn-dougherty

errors=false

files=`ls src/rescript/**/**/*.res src/rescript/**/*.res src/rescript/*.res`
for file in $files
do
current=`cat $file`
linted=`echo "${current}" | rescript format -stdin .res`
diff=`diff <(echo $current) <(echo $linted)`

if [ ${#diff} -gt 0 ]
then
echo "ERROR: $file doesn't pass lint"
errors=true
fi
done

files=`ls src/rescript/**/**/*.resi src/rescript/**/*.resi` # src/rescript/*/resi
for file in $files
do
current=`cat $file`
linted=`echo "${current}" | rescript format -stdin .resi`
diff=`diff <(echo $current) <(echo $linted)`
if [ ${#diff} -gt 0 ]
then
echo "ERROR: $file doesn't pass lint"
errors=true
fi
done


if $errors
then
exit 1
else
echo "All files pass lint"
fi
4 changes: 4 additions & 0 deletions packages/squiggle-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"test": "jest",
"test:watch": "jest --watchAll",
"coverage": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report html",
"lint:rescript": "./lint.sh",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:rescript && yarn lint:prettier",
"format": "rescript format -all && prettier --write .",
"all": "yarn build && yarn bundle && yarn test"
},
"keywords": [
Expand Down
27 changes: 14 additions & 13 deletions packages/squiggle-lang/src/rescript/OldInterpreter/ASTTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,20 @@ module SamplingDistribution = {
let i1 = renderIfIsNotSamplingDistribution(evaluationParams, t1)
let i2 = renderIfIsNotSamplingDistribution(evaluationParams, t2)
E.R.merge(i1, i2) |> E.R.bind(_, ((a, b)) => {
let samples = getCombinationSamples(
evaluationParams.samplingInputs.sampleCount,
algebraicOp,
a,
b,
) |> E.O.toResult("Could not get samples")

let sampleSetDist = samples -> E.R.bind(SampleSetDist.make)

let pointSetDist =
sampleSetDist
-> E.R.bind(r =>
SampleSetDist.toPointSetDist(~samplingInputs=evaluationParams.samplingInputs, ~samples=r));
let samples =
getCombinationSamples(
evaluationParams.samplingInputs.sampleCount,
algebraicOp,
a,
b,
) |> E.O.toResult("Could not get samples")

let sampleSetDist = samples->E.R.bind(SampleSetDist.make)

let pointSetDist =
sampleSetDist->E.R.bind(r =>
SampleSetDist.toPointSetDist(~samplingInputs=evaluationParams.samplingInputs, ~samples=r)
)
pointSetDist |> E.R.fmap(r => #Normalize(#RenderedDist(r)))
})
}
Expand Down
Loading