diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 965d36a..f68d858 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: - 'test/**/*.purs' - 'test/**/*.js' - '*.json' - - '*.dhall' + - '**/spago.yaml' - 'scripts/check-docs.mjs' - 'scripts/check-examples.mjs' - '.github/workflows/ci.yml' @@ -27,7 +27,7 @@ on: - 'test/**/*.purs' - 'test/**/*.js' - '*.json' - - '*.dhall' + - '**/spago.yaml' - 'scripts/check-docs.mjs' - 'scripts/check-examples.mjs' - '.github/workflows/ci.yml' @@ -41,34 +41,41 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 22 + - name: Set up a PureScript toolchain uses: purescript-contrib/setup-purescript@main with: purescript: "unstable" purs-tidy: "latest" + - name: Install Spago + run: npm install -g spago@1.0.5 + - name: Cache PureScript dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: - key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }} + key: ${{ runner.os }}-spago-${{ hashFiles('**/spago.yaml') }} path: | .spago output - name: Cache NPM dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} path: node_modules - name: Install PureScript dependencies - run: spago install + run: spago fetch - name: Build source - run: spago build --no-install --purs-args '--censor-lib --strict' + run: spago build -p tecton --strict - name: Run tests - run: spago -x test.dhall test + run: spago test -p tecton - name: Check formatting run: purs-tidy check examples src test @@ -82,12 +89,6 @@ jobs: - name: Check docs run: npm run check-docs - - name: Verify Bower & Pulp - run: | - npm install bower pulp@16.0.0-0 - npx bower install - npx pulp build -- --censor-lib --strict - - if: github.ref == 'refs/heads/master' name: Dispatch tecton-halogen CI run: | @@ -99,7 +100,7 @@ jobs: - if: github.ref == 'refs/heads/master' id: count name: Get test count - run: echo "value=$(spago -x test.dhall test | grep Summary -A1 | tail -n 1 | cut -d "/" -f2 | cut -d " " -f1)" >> $GITHUB_OUTPUT + run: echo "value=$(spago test -p tecton | grep Summary -A1 | tail -n 1 | cut -d "/" -f2 | cut -d " " -f1)" >> $GITHUB_OUTPUT - if: github.ref == 'refs/heads/master' name: Update test count data @@ -129,4 +130,4 @@ jobs: uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./book \ No newline at end of file + publish_dir: ./book diff --git a/.gitignore b/.gitignore index f752ea6..43f5476 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.purs* /.psa* /.spago +/spago.lock diff --git a/example.dhall b/example.dhall deleted file mode 100644 index 8ee4ebf..0000000 --- a/example.dhall +++ /dev/null @@ -1,5 +0,0 @@ -let conf = ./spago.dhall - -in conf // { - dependencies = conf.dependencies # ["console", "effect"] -} diff --git a/examples/spago.yaml b/examples/spago.yaml new file mode 100644 index 0000000..11f26f2 --- /dev/null +++ b/examples/spago.yaml @@ -0,0 +1,6 @@ +package: + name: tecton-examples + dependencies: + - console: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" + - tecton: "*" diff --git a/packages.dhall b/packages.dhall deleted file mode 100644 index 276dc70..0000000 --- a/packages.dhall +++ /dev/null @@ -1,5 +0,0 @@ -let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20221015/packages.dhall - sha256:4949f9f5c3626ad6a83ea6b8615999043361f50905f736bc4b7795cba6251927 - -in upstream diff --git a/scripts/check-examples.mjs b/scripts/check-examples.mjs index 7517405..05e8c08 100644 --- a/scripts/check-examples.mjs +++ b/scripts/check-examples.mjs @@ -4,7 +4,7 @@ import path from "path"; import { execa } from "execa"; import { diffLines } from "diff"; -for (let x of ["examples", "example.dhall"]) { +for (let x of ["examples", "examples/spago.yaml"]) { try { await fs.access(x); } @@ -32,7 +32,8 @@ for (let example of examples) { } catch {} - const { stdout: actual } = await execa("spago", ["-x", "example.dhall", "run", "-p", path.join(examplesDir, `${example}.purs`), "-m", `Example.${example}`]); + await execa("spago", ["build", "-p", "tecton-examples", "--purs-args", path.join(examplesDir, `${example}.purs`)]); + const { stdout: actual } = await execa("node", ["--input-type=module", "-e", `import { main } from './output/Example.${example}/index.js'; main();`]); const needsUpdate = updateFlag || !expected; @@ -69,7 +70,7 @@ const typeErrors = typeErrorsListing.flatMap(x => x.match(/^[A-Za-z]+(?=\.purs$) for (let typeError of typeErrors) { try { - await execa("spago", ["build", "-p", path.join(typeErrorsDir, `${typeError}.purs`)]); + await execa("spago", ["build", "-p", "tecton", "--purs-args", path.join(typeErrorsDir, `${typeError}.purs`)]); process.stdout.write(chalk.red(`✗ TypeError.${typeError} compiled successfully.\n`)); process.exit(1); } diff --git a/spago.dhall b/spago.dhall deleted file mode 100644 index 18b7307..0000000 --- a/spago.dhall +++ /dev/null @@ -1,20 +0,0 @@ -{ name = "tecton" -, license = "MIT" -, repository = "https://github.com/nsaunders/purescript-tecton" -, dependencies = - [ "colors" - , "either" - , "foldable-traversable" - , "integers" - , "lists" - , "numbers" - , "prelude" - , "record" - , "strings" - , "transformers" - , "tuples" - , "web-html" - ] -, packages = ./packages.dhall -, sources = [ "src/**/*.purs" ] -} diff --git a/spago.yaml b/spago.yaml new file mode 100644 index 0000000..691f6e3 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,28 @@ +package: + name: tecton + publish: + version: 0.2.2 + license: MIT + location: + githubOwner: nsaunders + githubRepo: purescript-tecton + dependencies: + - colors: ">=7.0.1 <8.0.0" + - either: ">=6.0.0 <7.0.0" + - foldable-traversable: ">=6.0.0 <7.0.0" + - integers: ">=6.0.0 <7.0.0" + - lists: ">=7.0.0 <8.0.0" + - numbers: ">=9.0.0 <10.0.0" + - prelude: ">=6.0.0 <7.0.0" + - record: ">=4.0.0 <5.0.0" + - strings: ">=6.0.0 <7.0.0" + - transformers: ">=6.0.0 <7.0.0" + - tuples: ">=7.0.0 <8.0.0" + - web-html: ">=4.0.0 <5.0.0" + test: + main: Test.Main + dependencies: + - aff: ">=7.0.0 <8.0.0" + - effect: ">=4.0.0 <5.0.0" + - spec: ">=7.0.0 <8.0.0" +workspace: {} diff --git a/test.dhall b/test.dhall deleted file mode 100644 index 78f93d9..0000000 --- a/test.dhall +++ /dev/null @@ -1,6 +0,0 @@ -let conf = ./spago.dhall - -in conf // { - sources = conf.sources # ["test/**/*.purs"], - dependencies = conf.dependencies # ["aff", "effect", "spec"] -}