Skip to content

Commit 0d1359f

Browse files
authored
Circleci project setup (#105)
1 parent bd19564 commit 0d1359f

File tree

11 files changed

+349
-146
lines changed

11 files changed

+349
-146
lines changed

.circleci/config.yml

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/windows@5.0.0
5+
6+
jobs:
7+
build-osx:
8+
macos:
9+
xcode: 14.0.0
10+
environment:
11+
BUILD_VERSION_NUMBER: ${CIRCLE_TAG}
12+
DEBUG: ""
13+
steps:
14+
- checkout
15+
- run:
16+
name: "make"
17+
command: |
18+
export PATH="/usr/local/opt/bison/bin:$PATH"
19+
make
20+
file -L lslint
21+
- run:
22+
name: "move"
23+
command: |
24+
mkdir -p binary/osx/
25+
cp lslint binary/osx/
26+
- persist_to_workspace:
27+
root: binary
28+
paths:
29+
- osx/lslint
30+
build-linux64:
31+
docker:
32+
- image: cimg/base:stable
33+
resource_class: small
34+
environment:
35+
BUILD_VERSION_NUMBER: ${CIRCLE_TAG}
36+
DEBUG: ""
37+
steps:
38+
- checkout
39+
- run:
40+
name: "install flex and bison"
41+
command: |
42+
sudo apt-get update
43+
sudo apt-get install flex bison
44+
- run:
45+
name: "make"
46+
command: |
47+
make
48+
file -L lslint
49+
- run:
50+
name: "move"
51+
command: |
52+
mkdir -p binary/linux64/
53+
cp lslint binary/linux64/
54+
cp kwdb_version.txt binary
55+
- persist_to_workspace:
56+
root: binary
57+
paths:
58+
- linux64/lslint
59+
- kwdb_version.txt
60+
build-linux32:
61+
docker:
62+
- image: cimg/base:stable
63+
resource_class: small
64+
environment:
65+
BUILD_VERSION_NUMBER: ${CIRCLE_TAG}
66+
BUILD_ADDITIONAL_ARG: "-m32"
67+
DEBUG: ""
68+
steps:
69+
- checkout
70+
- run:
71+
name: "install flex and bison and i386 related modules"
72+
command: |
73+
sudo apt-get update
74+
sudo apt-get install flex bison gcc-multilib g++-multilib
75+
- run:
76+
name: "make"
77+
command: |
78+
make
79+
file -L lslint
80+
- run:
81+
name: "move"
82+
command: |
83+
mkdir -p binary/linux32/
84+
cp lslint binary/linux32/
85+
- persist_to_workspace:
86+
root: binary
87+
paths:
88+
- linux32/lslint
89+
build-windows64:
90+
executor:
91+
name: win/default
92+
steps:
93+
- checkout
94+
- run:
95+
name: place-flex_bison
96+
command: |
97+
curl.exe -L -O https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip
98+
mkdir C:\win_flex_bison
99+
tar -xf win_flex_bison-2.5.25.zip -C C:\win_flex_bison
100+
- run:
101+
name: compile
102+
command: |
103+
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
104+
$instanceId = & $vswhere -property instanceId -format value
105+
$installationPath = & $vswhere -property installationPath -format value
106+
Import-Module (Join-Path $installationPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
107+
Enter-VsDevShell $instanceId -SkipAutomaticLocation -Arch amd64
108+
$Env:BUILD_VERSION_NUMBER="$Env:CIRCLE_TAG"
109+
$Env:BUILD_DATE="$(Get-Date -Format "yyyy-MM-dd")"
110+
$Env:Path+=";C:\win_flex_bison"
111+
nmake /F NMakefile
112+
dumpbin /headers lslint.exe
113+
- run:
114+
name: move
115+
command: |
116+
mkdir binary\win64
117+
cp lslint.exe binary\win64
118+
- persist_to_workspace:
119+
root: binary
120+
paths:
121+
- win64/lslint.exe
122+
build-windows32:
123+
executor:
124+
name: win/default
125+
steps:
126+
- checkout
127+
- run:
128+
name: place-flex_bison
129+
command: |
130+
curl.exe -L -O https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip
131+
mkdir C:\win_flex_bison
132+
tar -xf win_flex_bison-2.5.25.zip -C C:\win_flex_bison
133+
- run:
134+
name: compile
135+
command: |
136+
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
137+
$instanceId = & $vswhere -property instanceId -format value
138+
$installationPath = & $vswhere -property installationPath -format value
139+
Import-Module (Join-Path $installationPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
140+
Enter-VsDevShell $instanceId -SkipAutomaticLocation -Arch x86
141+
$Env:BUILD_VERSION_NUMBER="$Env:CIRCLE_TAG"
142+
$Env:BUILD_DATE="$(Get-Date -Format "yyyy-MM-dd")"
143+
$Env:Path+=";C:\win_flex_bison"
144+
nmake /F NMakefile
145+
dumpbin /headers lslint.exe
146+
- run:
147+
name: zip
148+
command: |
149+
mkdir binary\win32
150+
cp lslint.exe binary\win32
151+
- persist_to_workspace:
152+
root: binary
153+
paths:
154+
- win32/lslint.exe
155+
release:
156+
docker:
157+
- image: cimg/go:1.20
158+
resource_class: small
159+
steps:
160+
- attach_workspace:
161+
at: ./artifacts
162+
- store_artifacts:
163+
path: ./artifacts
164+
- run:
165+
name: zip
166+
command: |
167+
mkdir zips
168+
pushd artifacts/win32/; zip ../../zips/lslint_${CIRCLE_TAG}_win32.zip lslint.exe; popd
169+
pushd artifacts/win64/; zip ../../zips/lslint_${CIRCLE_TAG}_win64.zip lslint.exe; popd
170+
pushd artifacts/linux32/; zip ../../zips/lslint_${CIRCLE_TAG}_linux32.zip lslint; popd
171+
pushd artifacts/linux64/; zip ../../zips/lslint_${CIRCLE_TAG}_linux64.zip lslint; popd
172+
pushd artifacts/osx/; zip ../../zips/lslint_${CIRCLE_TAG}_osx.zip lslint; popd
173+
- run:
174+
name: "Publish Release on GitHub"
175+
command: |
176+
RELEASE_BODY="$(tail -n +2 artifacts/kwdb_version.txt)"
177+
go install github.com/tcnksm/ghr@latest
178+
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -b "${RELEASE_BODY}" -delete "${CIRCLE_TAG}" zips/
179+
check-builtins:
180+
docker:
181+
- image: cimg/python:3.11
182+
resource_class: small
183+
steps:
184+
- checkout
185+
- add_ssh_keys:
186+
fingerprints:
187+
- "4f:89:75:4a:ac:38:d6:86:6a:99:d3:77:5a:cf:dd:32"
188+
- run:
189+
name: fetch_and_compare
190+
command: |
191+
curl -O https://raw.githubusercontent.com/Sei-Lisa/kwdb/master/outputs/builtins.txt
192+
hasdiff=$(git status --porcelain builtins.txt)
193+
if [ -n "${hasdiff}" ] ; then
194+
make builtins_txt.cc
195+
curl https://raw.githubusercontent.com/Sei-Lisa/kwdb/master/lsl2dfg/LSL2dfg.py -o /tmp/LSL2dfg.py
196+
curl https://raw.githubusercontent.com/Sei-Lisa/kwdb/master/database/kwdb.xml -o /tmp/kwdb.xml
197+
python /tmp/LSL2dfg.py --version --grid=sl,os --database=/tmp/kwdb.xml > kwdb_version.txt
198+
git config user.name "Makopoppo(via CircleCI)"
199+
git config user.email "bokemako@gmail.com"
200+
git add builtins.txt builtins_txt.cc kwdb_version.txt
201+
git commit -m "update builtins_txt [ci skip]"
202+
git push --set-upstream origin ${CIRCLE_BRANCH}
203+
fi
204+
205+
parameters:
206+
run-schedule:
207+
type: boolean
208+
default: false
209+
210+
workflows:
211+
release-all:
212+
when:
213+
not: << pipeline.parameters.run-schedule >>
214+
jobs:
215+
- build-linux64:
216+
filters:
217+
tags:
218+
only: /.*/
219+
- build-linux32:
220+
filters:
221+
tags:
222+
only: /.*/
223+
- build-windows64:
224+
filters:
225+
tags:
226+
only: /.*/
227+
- build-windows32:
228+
filters:
229+
tags:
230+
only: /.*/
231+
- build-osx:
232+
filters:
233+
tags:
234+
only: /.*/
235+
- release:
236+
filters:
237+
tags:
238+
only:
239+
- /.*/
240+
branches:
241+
ignore: /.*/
242+
requires:
243+
- build-linux32
244+
- build-linux64
245+
- build-windows64
246+
- build-windows32
247+
- build-osx
248+
check-builtins:
249+
when: << pipeline.parameters.run-schedule >>
250+
jobs:
251+
- check-builtins
252+

.github/workflows/pull_builtins_txt.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
# Compiler output files #
2-
#########################
3-
*.o
4-
*.obj
5-
*.output
6-
lslint
7-
*.log
8-
*db
9-
*.tlog
10-
*.lastbuildstate
11-
*.ilk
12-
lex.yy.c
13-
lslmini.tab.*
14-
*.pdb
15-
.vs\*
16-
build_dir\
17-
# OS generated files #
18-
######################
19-
.DS_Store
20-
.DS_Store?
21-
._*
22-
.Spotlight-V100
23-
.Trashes
24-
ehthumbs.db
25-
Thumbs.db
26-
*.suo
27-
/binary
28-
# Editor backups #
29-
##################
30-
*~
31-
/.vs
1+
# Compiler output files #
2+
#########################
3+
*.o
4+
*.obj
5+
*.output
6+
lslint
7+
lslint.exe
8+
*.log
9+
*db
10+
*.tlog
11+
*.lastbuildstate
12+
*.ilk
13+
lex.yy.c
14+
lslmini.tab.*
15+
*.pdb
16+
.vs\*
17+
build_dir\
18+
# OS generated files #
19+
######################
20+
.DS_Store
21+
.DS_Store?
22+
._*
23+
.Spotlight-V100
24+
.Trashes
25+
ehthumbs.db
26+
Thumbs.db
27+
*.suo
28+
/binary
29+
# Editor backups #
30+
##################
31+
*~
32+
/.vs

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

NMakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NUMBER = v1.2.7
2-
BUILD_DATE = %DATE:~-10,4%-%DATE:~-5,2%-%DATE:~-2,2%
1+
VERSION_NUMBER = $(BUILD_VERSION_NUMBER)
2+
BUILD_DATE = $(BUILD_DATE)
33

44
#
55
# 1. Download "Win flex-bison" and unpack it
@@ -9,7 +9,7 @@ BUILD_DATE = %DATE:~-10,4%-%DATE:~-5,2%-%DATE:~-2,2%
99
# You need the windows 7.0 SDK or later.
1010
# For Windows XP compatible binaries, the windows 7.0 or 7.1 SDK is required.
1111
#
12-
# 3. Add 1. unpacked directory to PATH.
12+
# 3. Add 1. unpacked directory to PATH. VERSION_NUMBER and BUILD_DATE are also required.
1313
#
1414
# 4. Run "nmake /F NMakefile" to build or "nmake /F NMakefile debug=1" to build debuggable binary.
1515
#

0 commit comments

Comments
 (0)