Skip to content

Commit d978033

Browse files
authored
Set up CI with Azure Pipelines (#2)
1 parent 7698cad commit d978033

File tree

2 files changed

+106
-1
lines changed

2 files changed

+106
-1
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Synthesis
2-
[![Build Status: Travis](https://img.shields.io/travis/com/mratsim/Synthesis?label=Travis%20%28Linux%2FMac%20-%20x86%2FARM%29)](https://travis-ci.com/mratsim/Synthesis)
2+
[![Build Status: Travis](https://img.shields.io/travis/com/mratsim/Synthesis?label=Travis%20%28Linux%2FMac%20-%20x86_64%2FARM64%29)](https://travis-ci.com/mratsim/Synthesis)
3+
[![Build Status: Travis](https://img.shields.io/azure-devops/tests/numforge/Synthesis/1?label=Azure%20%28Windows%2032-bit%2F64-bit%29)](https://dev.azure.com/numforge/Synthesis/_build/latest?definitionId=1&branchName=master)
34
[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
45
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
56
![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)

Diff for: azure-pipelines.yml

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
jobs:
2+
- job: Windows
3+
4+
pool:
5+
vmImage: windows-latest
6+
7+
strategy:
8+
matrix:
9+
# Nim requires enforcing ARCH="x86" and ucpu
10+
# for 32-bit target as it seems like the machine is 64-bit
11+
STABLE-32bit:
12+
ARCH: x86
13+
ucpu: i686
14+
PLATFORM: x86
15+
CHANNEL: stable
16+
STABLE-64bit:
17+
PLATFORM: x64
18+
CHANNEL: stable
19+
DEVEL-32bit:
20+
ARCH: x86
21+
ucpu: i686
22+
PLATFORM: x86
23+
CHANNEL: devel
24+
DEVEL-64bit:
25+
PLATFORM: x64
26+
CHANNEL: devel
27+
steps:
28+
- task: CacheBeta@1
29+
displayName: 'cache Nim binaries'
30+
inputs:
31+
key: NimBinaries | $(Agent.OS) | $(CHANNEL) | $(PLATFORM)
32+
path: NimBinaries
33+
34+
- task: CacheBeta@1
35+
displayName: 'cache MinGW-w64'
36+
inputs:
37+
key: mingwCache | 8_1_0 | $(PLATFORM)
38+
path: mingwCache
39+
40+
- powershell: |
41+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
42+
displayName: 'long path support'
43+
- bash: |
44+
set -e
45+
echo "Installing MinGW-w64"
46+
if [[ $PLATFORM == "x86" ]]; then
47+
MINGW_FILE="i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z"
48+
MINGW_URL="https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/${MINGW_FILE}"
49+
MINGW_DIR="mingw32"
50+
else
51+
MINGW_FILE="x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z"
52+
MINGW_URL="https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/${MINGW_FILE}"
53+
MINGW_DIR="mingw64"
54+
fi
55+
mkdir -p mingwCache
56+
pushd mingwCache
57+
if [[ ! -e "$MINGW_FILE" ]]; then
58+
rm -f *.7z
59+
curl -OLsS "$MINGW_URL"
60+
fi
61+
7z x -y -bd "$MINGW_FILE" >/dev/null
62+
mkdir -p /c/custom
63+
mv "$MINGW_DIR" /c/custom/
64+
popd
65+
export PATH="/c/custom/${MINGW_DIR}/bin:$PATH"
66+
67+
- bash: |
68+
echo "Building Nim"
69+
if [ "${CHANNEL}" = stable ]; then
70+
BRANCH="v$(curl https://nim-lang.org/channels/stable)"
71+
else
72+
BRANCH="${CHANNEL}"
73+
fi
74+
mkdir -p NimBinaries
75+
pushd NimBinaries
76+
if [ ! -x "nim-${CHANNEL}/bin/nim" ]; then
77+
git clone -b "${BRANCH}" https://github.com/nim-lang/nim "nim-${CHANNEL}/"
78+
pushd "nim-${CHANNEL}"
79+
git clone --depth 1 https://github.com/nim-lang/csources csources/
80+
pushd csources
81+
make -j $ncpu CC=gcc
82+
popd
83+
rm -rf csources
84+
bin/nim c koch
85+
./koch boot -d:release
86+
./koch tools
87+
else
88+
pushd "nim-${CHANNEL}"
89+
git fetch origin "${BRANCH}"
90+
if ! git merge FETCH_HEAD | grep "Already up.to.date"; then
91+
bin/nim c koch
92+
./koch boot -d:release
93+
./koch tools
94+
fi
95+
fi
96+
popd
97+
popd
98+
export PATH="NimBinaries/nim-${CHANNEL}/bin${PATH:+:$PATH}"
99+
100+
echo "Testing"
101+
nimble.exe refresh
102+
nimble.exe test
103+
104+
displayName: 'build and test'

0 commit comments

Comments
 (0)