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

CI JS #64

Merged
merged 48 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c2ad8d3
init
juancarlospaco Jan 3, 2021
6f62db9
tiny change
juancarlospaco Jan 3, 2021
574d6eb
simple
juancarlospaco Jan 3, 2021
5ab4674
No skip whole PR is too much
juancarlospaco Jan 3, 2021
eb062ff
No skip whole PR is too much
juancarlospaco Jan 3, 2021
915f262
No skip whole PR is too much
juancarlospaco Jan 3, 2021
29181bb
Fix skip
juancarlospaco Jan 3, 2021
28147e0
Fix skip
juancarlospaco Jan 3, 2021
6eeee8c
Fix the fixes
juancarlospaco Jan 3, 2021
797b58e
Fix the fixes
juancarlospaco Jan 3, 2021
6658098
Fix the fixes
juancarlospaco Jan 3, 2021
92f252a
is declared but not used
juancarlospaco Jan 3, 2021
180cadb
oh voi
juancarlospaco Jan 3, 2021
5b64b53
:O
juancarlospaco Jan 3, 2021
bbdd911
tmatching eats too many registers on CT
juancarlospaco Jan 3, 2021
bba070b
Bugs on std/private
juancarlospaco Jan 3, 2021
d8cff6f
matching stuff
juancarlospaco Jan 3, 2021
4109f55
matching stuff
juancarlospaco Jan 3, 2021
5c38cfe
matching stuff
juancarlospaco Jan 3, 2021
ed2b8bb
typo
juancarlospaco Jan 3, 2021
563bc89
windows path
juancarlospaco Jan 3, 2021
3d6f23f
wip
juancarlospaco Jan 3, 2021
3143b83
wip
juancarlospaco Jan 3, 2021
12937a6
wip
juancarlospaco Jan 3, 2021
109bfa9
stylecheck move
juancarlospaco Jan 3, 2021
8030d5e
more fix
juancarlospaco Jan 3, 2021
41b724a
try re-enable a test
juancarlospaco Jan 3, 2021
5c7d630
Test is flaky :(
juancarlospaco Jan 3, 2021
3d57dd0
Test is flaky :(
juancarlospaco Jan 3, 2021
b5c18dd
try re-enable a test
juancarlospaco Jan 3, 2021
06b3ea3
Test is flaky :(
juancarlospaco Jan 3, 2021
f6a599d
https://github.com/nim-lang/fusion/pull/54#discussion_r551051972
juancarlospaco Jan 3, 2021
50778ca
doc js
juancarlospaco Jan 3, 2021
3564b72
doc js
juancarlospaco Jan 3, 2021
8571ac1
flaky gonna flakify
juancarlospaco Jan 3, 2021
fd00ccd
Fix a when
juancarlospaco Jan 3, 2021
d5b31c5
make it work
juancarlospaco Jan 3, 2021
40a9596
make it work
juancarlospaco Jan 3, 2021
105a863
make it work
juancarlospaco Jan 3, 2021
e90f7a9
Make the C index overwrite the JS index, output JS to same folder as …
juancarlospaco Jan 3, 2021
443824f
Lets break it
juancarlospaco Jan 3, 2021
7f23ab9
Stuff on Nim repo has broken style :(
juancarlospaco Jan 3, 2021
99faeb1
Lets break it
juancarlospaco Jan 3, 2021
b2a9ab1
Stuff on Nim repo has broken style :(
juancarlospaco Jan 3, 2021
69b0173
https://github.com/nim-lang/fusion/pull/64#issuecomment-753769250
juancarlospaco Jan 4, 2021
5513f98
ReSync
juancarlospaco Jan 5, 2021
ff9ae34
Revert matchin
juancarlospaco Jan 5, 2021
a03fbd4
Fix for JS CI
juancarlospaco Jan 8, 2021
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
20 changes: 4 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ on: [push, pull_request]

jobs:
build:
if: !contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[skip ci]')
if: |
!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[skip ci]')

strategy:
fail-fast: false
matrix:
branch: [version-1-0, version-1-2, version-1-4, devel]
branch: ["1.0.0", "1.2.0", "1.4.0", "devel"]
target:
- os: linux
cpu: amd64
Expand All @@ -33,6 +34,7 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
steps:
- uses: actions/setup-node@v2
- name: Checkout fusion
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -129,17 +131,3 @@ jobs:
target_branch: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-devel-latest

- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-devel-latest
6 changes: 4 additions & 2 deletions fusion.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ srcDir = "src"
requires "nim >= 1.0.0"

task docs, "":
timotheecour marked this conversation as resolved.
Show resolved Hide resolved
# can customize, e.g.:
# exec "nim r src/fusion/docutils " & srcDir & " --outdir:htmldocs2 -d:foo"
# JavaScript
when (NimMajor, NimMinor) >= (1, 4):
exec "nim c -r -d:fusionDocJs src/fusion/docutils " & srcDir & " -d:js -d:fusionDocJs"
# C
exec "nim c -r src/fusion/docutils " & srcDir
31 changes: 21 additions & 10 deletions src/fusion/docutils.nim
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import std/[os, strformat, sugar, osproc]
import std/[os, sugar, strutils, osproc]
import std/private/globs


const blockList =
when not defined(js): ["nimcache", "htmldocs", "js"]
else: ["nimcache", "htmldocs"]
const
blockList = ["nimcache", "htmldocs"] # Folders to explicitly ignore.
baseCmd = " doc --project --docroot --outdir:htmldocs --styleCheck:hint " # nim doc command part that never changes
jsDocOpts = # nim doc command part that changes for JS compat.
when defined(fusionDocJs): "-b:js "
else: ""
docComand = baseCmd & jsDocOpts


iterator findNimSrcFiles*(dir: string): string =
proc follow(a: PathEntry): bool =
func follow(a: PathEntry): bool =
a.path.lastPathPart notin blockList

for entry in walkDirRecFilter(dir, follow = follow):
Expand All @@ -17,18 +22,24 @@ iterator findNimSrcFiles*(dir: string): string =

proc genCodeImportAll*(dir: string): string =
result = "{.warning[UnusedImport]: off.}\n"
for a in findNimSrcFiles(dir):
let s = "".dup(addQuoted(a))
result.add &"import {s}\n"
var name, prefix: string
for nimfile in findNimSrcFiles(dir):
name = nimfile.extractFilename
prefix =
if name.startsWith "js":
"when defined(js): import "
else:
"when not defined(js): import "
result.add prefix & "".dup(addQuoted(nimfile)) & "\n"


proc genDocs(dir: string, nim = "", args: seq[string]) =
let code = genCodeImportAll(dir)
let extra = quoteShellCommand(args)
let nim = if nim.len == 0: getCurrentCompilerExe() else: nim
let ret = execCmdEx(fmt"{nim} doc -r --project --docroot --outdir:htmldocs {extra} -", input = code)
let ret = execCmdEx(nim & docComand & extra & " - ", input = code)
if ret.exitCode != 0:
doAssert false, ret.output & "\n" & code
doAssert false, ret.output & '\n' & code


when isMainModule:
Expand Down
2 changes: 1 addition & 1 deletion src/fusion/matching.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ macro match*(n: untyped): untyped =
# `mixinList`
`pos`
let expr {.inject.} = `head`
let pos {.inject.}: int = 0
let pos {.inject, used.}: int = 0
`matchcase`

# echo result.repr
Expand Down
1 change: 1 addition & 0 deletions tests/config.nims
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
switch("path", "$projectDir/../src")
switch("styleCheck", "hint")
69 changes: 37 additions & 32 deletions tests/tmatching.nim
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import std/[strutils, sequtils, strformat, sugar,
macros, options, tables, json, algorithm]
macros, options, tables, json]

import fusion/matching
{.experimental: "caseStmtMacros".}
{.push hint[XDeclaredButNotUsed]: off.}
{.push hint[ConvFromXtoItselfNotNeeded]:off.}
{.push hint[CondTrue]:off.}

import unittest

Expand Down Expand Up @@ -60,7 +63,7 @@ suite "Matching":
of eN12:
f2: float

let val = Obj1()
let val {.used.} = Obj1()

test "Pattern parser tests":
macro main(): untyped =
Expand Down Expand Up @@ -161,7 +164,9 @@ suite "Matching":
doAssert head is NimNode
doAssert body is NimNode

main()
when (NimMajor, NimMinor, NimPatch) >= (1, 2, 0):
# https://github.com/nim-lang/fusion/pull/64/checks?check_run_id=1640671490#step:8:251
main() # Fails on 1.0.0 only.

test "Pattern parser broken brackets":
block: JArray[@a, @b] := %*[1, 3]
Expand Down Expand Up @@ -875,44 +880,44 @@ suite "Matching":


multitestSince "Tree builder custom type", (1, 4, 0):
when (NimMajor, NimMinor, NimPatch) >= (1, 5, 1):
discard makeTree(HtmlNode, Base())
discard makeTree(HtmlNode, base())
discard makeTree(HtmlNode, base([link()]))
discard makeTree(HtmlNode):
base:
link(text: "hello")

discard makeTree(HtmlNode, Base())
discard makeTree(HtmlNode, base())
discard makeTree(HtmlNode, base([link()]))
discard makeTree(HtmlNode):
base:
link(text: "hello")

template wrapper1(body: untyped): untyped =
makeTree(HtmlNode):
body

template wrapper2(body: untyped): untyped =
makeTree(HtmlNode, body)
template wrapper1(body: untyped): untyped =
makeTree(HtmlNode):
body

let tmp1 = wrapper1:
base: link()
base: link()
template wrapper2(body: untyped): untyped =
makeTree(HtmlNode, body)

doAssert tmp1 is seq[HtmlNode]
let tmp1 = wrapper1:
base: link() # Repro on 1.4.0 only, not 1.4.2 or newer.
base: link() # https://github.com/nim-lang/fusion/pull/64/checks?check_run_id=1640367574#step:8:67
# https://github.com/nim-lang/fusion/pull/64/checks?check_run_id=1640605058#step:8:67
doAssert tmp1 is seq[HtmlNode]


let tmp3 = wrapper1:
base:
base: link()
base: link()
let tmp3 = wrapper1:
base:
base: link()
base: link()

doAssert tmp3 is HtmlNode
doAssert tmp3 is HtmlNode

let tmp2 = wrapper1:
base:
link()
let tmp2 = wrapper1:
base:
link()

doAssert tmp2 is HtmlNode
doAssert tmp2 is HtmlNode

discard wrapper2:
base:
link()
discard wrapper2:
base:
link()


multitest "Tree construction sequence operators":
Expand Down