Skip to content

Commit

Permalink
Merge pull request #5 from arnetheduck/wo
Browse files Browse the repository at this point in the history
windows / osx in ci
  • Loading branch information
arnetheduck committed Dec 11, 2023
2 parents 965d036 + 3c32c84 commit 862fa02
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
38 changes: 30 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,58 @@ jobs:
matrix:
target:
- os: linux
cpu: amd64
TEST_LANG: c
triple: x86_64-linux-musl
name: linux_x64
- os: macosx
triple: x86_64-apple-darwin14
name: apple_x64
- os: windows
triple: x86_64-w64-mingw32
name: windows_x64
include:
- target:
os: linux
builder: ubuntu-20.04
shell: bash
- target:
os: macosx
builder: macos-11
- target:
os: windows
builder: windows-2019
defaults:
run:
shell: ${{ matrix.shell }}
shell: bash

name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.target.TEST_LANG }}'
name: '${{ matrix.target.name }}'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch nimble
uses: robinraju/release-downloader@v1.8
with:
repository: "nim-lang/nimble"
tag: "latest"
fileName: "nimble-${{matrix.target.name}}.tar.gz"
extract: false
- name: Setup env
run: |
wget https://github.com/nim-lang/nimble/releases/download/latest/nimble-linux_x64.tar.gz
tar xvf nimble-linux_x64.tar.gz
# extract: true doesn't work on osx :/
tar xvf nimble-${{matrix.target.name}}.tar.gz
# needed for nimble on windows
curl -L "https://curl.se/ca/cacert.pem" -o cacert.pem
echo "$PWD" >> $GITHUB_PATH
- name: Build nph
run: |
ls -l
nimble setup -l
nimble build
- name: Check formatting
run: |
find -name "*.nim" ! -path "./tests/before/*" ! -path "./nimbledeps/*" -print0 | xargs -0 -n1 ./nph
find src tests/after -name "*.nim" -print0 | xargs -0 -n1 ./nph
git diff
# find -name "*.nim" ! -path "./tests/before/*" ! -path "./nimbledeps/*" -print0 | xargs -0 -n1 ./nph --check
3 changes: 2 additions & 1 deletion src/astcmp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Compare two AST's for semantic equivalence - aka undo whitespace bugs in the
## Nim parser / grammar

import ast, parser, idents, options, sequtils
import
"$nim"/compiler/[ast, parser, idents, options], std/sequtils

type
Equivalence* = enum
Expand Down
9 changes: 7 additions & 2 deletions src/nph.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import
"."/[astcmp, phast, phastalgo, phmsgs, phlineinfos, phoptions, phparser, phrenderer]
import idents

from astalgo import nil
from "$nim"/compiler/astalgo import nil

import parseopt, strutils, os, sequtils
import
std/[parseopt, strutils, os, sequtils]

static:
doAssert (NimMajor, NimMinor, NimPatch) == (2, 0, 0),
"nph needs to be compiled with nim 2.0.0 exactly for now"

const
Version = "0.1"
Expand Down
5 changes: 5 additions & 0 deletions src/phmsgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ when defined(nimpretty) or defined(nph):
proc fileSection*(conf: ConfigRef; fid: FileIndex; a, b: int): string =
substr(conf.m.fileInfos[fid.int].fullContent, a, b)

when not FileSystemCaseSensitive:
proc toLowerAscii(a: var string) {.inline.} =
for c in mitems(a):
if isUpperAscii(c): c = char(uint8(c) xor 0b0010_0000'u8)

proc canonicalCase(path: var string) {.inline.} =
## the idea is to only use this for checking whether a path is already in
## the table but otherwise keep the original case
Expand Down

0 comments on commit 862fa02

Please sign in to comment.