Skip to content

Commit 31e69e8

Browse files
Fix #27 (#54)
* action no compile * Fix code style * Check code style too * Update .github/workflows/ci.yml Co-authored-by: alaviss <[email protected]> * Allow poorly formatted code * pear review fixback * pear reviews * pear reviews Co-authored-by: alaviss <[email protected]>
1 parent 184ff2a commit 31e69e8

File tree

3 files changed

+24
-86
lines changed

3 files changed

+24
-86
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ on: [push, pull_request]
33

44
jobs:
55
build:
6-
if: |
7-
!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[skip ci]')
6+
if: !contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[skip ci]')
87

98
strategy:
109
fail-fast: false
@@ -97,87 +96,12 @@ jobs:
9796
shell: bash
9897
run: echo "${{ github.workspace }}/nim/bin" >> "${GITHUB_PATH}"
9998

100-
- name: Get latest Nim commit hash
101-
id: versions
102-
shell: bash
103-
run: |
104-
getHash() {
105-
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
106-
}
107-
nimHash=$(getHash nim-lang/Nim '${{ matrix.branch }}')
108-
csourcesHash=$(getHash nim-lang/csources)
109-
echo "::set-output name=nim::$nimHash"
110-
echo "::set-output name=csources::$csourcesHash"
111-
112-
- name: Restore prebuilt Nim from cache
113-
id: nim-cache
114-
uses: actions/cache@v1
115-
with:
116-
path: nim
117-
key: 'nim-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nim }}'
118-
119-
- name: Restore prebuilt csources from cache
120-
if: steps.nim-cache.outputs.cache-hit != 'true'
121-
id: csources-cache
122-
uses: actions/cache@v1
123-
with:
124-
path: csources/bin
125-
key: 'csources-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.csources }}'
126-
127-
- name: Checkout Nim csources
128-
if: >
129-
steps.csources-cache.outputs.cache-hit != 'true' &&
130-
steps.nim-cache.outputs.cache-hit != 'true'
131-
uses: actions/checkout@v2
132-
with:
133-
repository: nim-lang/csources
134-
path: csources
135-
ref: ${{ steps.versions.outputs.csources }}
136-
137-
- name: Checkout Nim
138-
if: steps.nim-cache.outputs.cache-hit != 'true'
139-
uses: actions/checkout@v2
99+
- name: Setup Nim
100+
uses: jiro4989/setup-nim-action@v1
140101
with:
141-
repository: nim-lang/Nim
142-
path: nim
143-
ref: ${{ steps.versions.outputs.nim }}
144-
145-
- name: Build Nim and associated tools
146-
if: steps.nim-cache.outputs.cache-hit != 'true'
147-
shell: bash
148-
run: |
149-
ncpu=
150-
ext=
151-
case '${{ runner.os }}' in
152-
'Linux')
153-
ncpu=$(nproc)
154-
;;
155-
'macOS')
156-
ncpu=$(sysctl -n hw.ncpu)
157-
;;
158-
'Windows')
159-
ncpu=$NUMBER_OF_PROCESSORS
160-
ext=.exe
161-
;;
162-
esac
163-
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
164-
165-
if [[ ! -e csources/bin/nim$ext ]]; then
166-
make -C csources -j $ncpu CC=gcc ucpu='${{ matrix.target.cpu }}'
167-
else
168-
echo 'Using prebuilt csources'
169-
fi
170-
cp -v csources/bin/nim$ext nim/bin
171-
172-
cd nim
173-
nim c koch
174-
./koch boot -d:release
175-
./koch tools -d:release
176-
# clean up to save cache space
177-
rm koch
178-
rm -rf nimcache
179-
rm -rf dist
180-
rm -rf .git
102+
nim-version: ${{ matrix.branch }}
103+
no-color: true # --noColor
104+
yes: true # --yes
181105

182106
- name: Run fusion tests
183107
shell: bash
@@ -205,3 +129,17 @@ jobs:
205129
target_branch: gh-pages
206130
env:
207131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
133+
- name: Cache choosenim
134+
id: cache-choosenim
135+
uses: actions/cache@v1
136+
with:
137+
path: ~/.choosenim
138+
key: ${{ runner.os }}-choosenim-devel-latest
139+
140+
- name: Cache nimble
141+
id: cache-nimble
142+
uses: actions/cache@v1
143+
with:
144+
path: ~/.nimble
145+
key: ${{ runner.os }}-nimble-devel-latest

tests/tbtreeordered.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ test "put":
157157
doAssert not t.hasKeyOrPut('j', 12)
158158
doAssert t.hasKeyOrPut('j', 34)
159159
doAssert t['j'] == 12
160-
doAssert t.mgetOrput('k', 56) == 56
161-
doAssert t.mgetOrput('k', 78) == 56
160+
doAssert t.mgetOrPut('k', 56) == 56
161+
doAssert t.mgetOrPut('k', 78) == 56
162162
doAssert t.len == 11
163163

164164
test "remove":

tests/tioutils.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ block: # duplicate, duplicateTo
1313
template captureStdout(body) : untyped =
1414
let stdoutFileno = stdout.getFileHandle()
1515
# Duplicate stoudFileno
16-
let stdout_dupfd = duplicate(stdoutFileno)
16+
let stdoutDupfd = duplicate(stdoutFileno)
1717
# Create a new file
1818
# You can use append strategy if you'd like
1919
let tmpFile: File = open(tmpFileName, fmWrite)
@@ -29,7 +29,7 @@ block: # duplicate, duplicateTo
2929
# Read tmp
3030
let ret = readFile(tmpFileName)
3131
# Restore stdout
32-
duplicateTo(stdout_dupfd, stdoutFileno)
32+
duplicateTo(stdoutDupfd, stdoutFileno)
3333
ret
3434

3535
proc duplicateStdout() =

0 commit comments

Comments
 (0)