Skip to content

Commit

Permalink
Added CI via Appveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeto committed Feb 21, 2018
1 parent 01e75c8 commit a680a9f
Show file tree
Hide file tree
Showing 17 changed files with 175 additions and 24 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pthreads-win32 is covered by the GNU Lesser General Public License
A copy of the GNU Lesser General Public License is distributed with
pthreads-win32 under the filename:

COPYING.FSF
LICENSE.lgpl-2.1

You should have received a copy of the version 2.1 GNU Lesser General
Public License with pthreads-win32; if not, write to:
Expand Down
File renamed without changes.
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ DLL_VERD= $(DLL_VER)d
FINDPTHREADS=contrib\FindPTHREADS-WIN32.cmake

# set this to 0 to minimize this Makefile's output during build
!IF !DEFINED(APPVEYOR)
DEBUG_BUILDING = 1
!ENDIF

!IF DEFINED(STATIC_BUILDING) || DEFINED(DEPLOY) || DEFINED(APPVEYOR) || DEFINED(SYSINSTALL) || DEFINED(SYSUNINSTALL)
!IF DEFINED(STATIC_BUILDING) || DEFINED(DEPLOY) || DEFINED(SYSINSTALL) || DEFINED(SYSUNINSTALL)
# set this to 0 to skip building static libraries
STATIC_BUILDING = 1
# for static libraries and import libraries to be able to
Expand All @@ -37,11 +39,12 @@ DLLDEST = $(DESTROOT)bin$(MACHINE)
LIBDEST = $(DESTROOT)lib$(MACHINE)
HDRDEST = $(DESTROOT)include
!ELSE
DESTROOT = PTHREADS-BUILT
DESTROOT = PTHREADS-BUILT$(APPVEYOR_BUILD_VERSION)
DLLDEST = $(DESTROOT)\bin$(MACHINE)
LIBDEST = $(DESTROOT)\lib$(MACHINE)
HDRDEST = $(DESTROOT)\include
DATADEST = $(DESTROOT)pthreads-win32\share
# XXX - defug?!
DATADEST = $(DESTROOT)\share\pthreads-win32\
!ENDIF

DEST_LIB_NAME = pthread.lib
Expand All @@ -58,8 +61,8 @@ MACHINE = \amd64
# Also find out a way to determine cmake's default install location
CMAKEDEST = $(CMAKEDEST)
!ELSEIF DEFINED(CMAKEDEST) || DEFINED(DEPLOY) && !DEFINED(SYSINSTALL)
CMAKEDEST = $(DATADEST)\cmake\modules
!ELSE !DEFINED(CMAKEDEST) && (DEFINED(SYSINSTALL) || DEFINED(SYSUNINSTALL))
CMAKEDEST = $(DESTROOT)\share\cmake\modules
!ELSEIF !DEFINED(CMAKEDEST) && (DEFINED(SYSINSTALL) || DEFINED(SYSUNINSTALL))
# XXX - assuming x64 host
CMAKEDEST = $(ProgramFiles(x86)\CMake
!ENDIF
Expand Down Expand Up @@ -323,9 +326,9 @@ install: all
$(CP) $(FINDPTHREADS) "$(CMAKEDEST)"
copy /Y $(FINDPTHREADS) "$(CMAKEDEST)\FindPTHREADS4W.cmake"
!ENDIF
!IF DEFINED(APPVEYOR) || DEFINED(DEPLOY)
!IF DEFINED(DEPLOY)
for %I in (COPYING COPYING.FSF README README.Borland README.CV README.NONPORTABLE README.Watcom README.WinCE WinCE-PORT) do $(CP) %I "$(DESTROOT)"
for %I in (ANNOUNCE BUGS ChangeLog CONTRIBUTORS COPYING COPYING.FSF FAQ MAINTAINERS NEWS PROGRESS) do $(CP) %I "$(DATADEST)\doc"
for %I in (ANNOUNCE BUGS ChangeLog CONTRIBUTORS COPYING COPYING.FSF FAQ MAINTAINERS NEWS PROGRESS) do $(CP) %I "$(DATADEST)\doc\"
copy /Y README.md "$(DESTROOT)\README.FIRST"
$(CP) /E /S /I manual "$(DATADEST)\manual"
!ENDIF
Expand All @@ -345,7 +348,7 @@ uninstall:
# XXX - remove!!! %pthread_root% environment variable
del "$(CMAKEDEST)\FindPTHREADS-WIN32.cmake"
del "$(CMAKEDEST)\FindPTHREADS4W.cmake"
!IF DEFINED(APPVEYOR) || DEFINED(DEPLOY)
!IF DEFINED(DEPLOY)
for %I in (ANNOUNCE BUGS ChangeLog CONTRIBUTORS COPYING COPYING.FSF FAQ MAINTAINERS NEWS PROGRESS README README.Borland README.CV README.NONPORTABLE README.Watcom README.WinCE WinCE-PORT) do del $(DESTROOT)\%I
!ENDIF

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/sgeto/pthreads-win32.svg?branch=privat)](https://travis-ci.org/sgeto/pthreads-win32)
[![Build status](https://ci.appveyor.com/api/projects/status/nvas416n8d4t48y0/branch/privat?svg=true)](https://ci.appveyor.com/project/sgeto/pthreads-win32/branch/privat)

![License](https://img.shields.io/badge/License-LGPL%20v2.1-lightgrey.svg)

Description
Also known as "pthreads-win32", POSIX Threads for Windows implements a large subset of the threads related API from the Single Unix Specification Version 3.
Expand Down
134 changes: 126 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,140 @@
# Build image.
image: Visual Studio 2017
# Build image. Creates 4 build jobs
image:
- Visual Studio 2017

# XXX - add output of git describe instead? v-2-10-0-rc-36-g04af0b4
# XXX isn't it 2.11.0?
version: 2.10.0-{build}
version: -v2.10.0-{build}

# Only build the 'privat' branch.
branches:
only:
- privat

#
# Skipping commits affecting these files
#
# XXX - add all the others
skip_commits:
files:
- '**/*.README.*'
- '**/*.md'
- '**/*.txt'
- '**/*.png'
- '**/*.jpg'
- '**/*.html'

environment:
global:
CL: -nologo
LINK: -nologo
URL: "https://ci.appveyor.com/api/projects/%APPVEYOR_ACCOUNT_NAME%/pthreads-win32/artifacts/PTHREADS-BUILT%APPVEYOR_BUILD_VERSION%.zip"

matrix:
- TOOLSET: MSVC1910 #-1919 = Visual Studio 15.0/2017 (v141 toolset)
ARCH: x86
- TOOLSET: MSVC1910
ARCH: x86_amd64
- TOOLSET: MSVC1900 # Visual Studio 14.0/2015 (v140 toolset)
ARCH: x86
- TOOLSET: MSVC1900
ARCH: x86_amd64
- TOOLSET: MSVC1900
ARCH: x86_arm
- TOOLSET: MSVC1900
ARCH: amd64_arm

matrix:
#
# Immediately finish build if one of the above jobs fails.
#
fast_finish: true
# allow_failures:
# - TOOLSET: MSVC1900
# ARCH: x86_arm
# - TOOLSET: MSVC1900
# ARCH: amd64_arm
# don't bother building these...
exclude:
- TOOLSET: MSVC1900
ARCH: x86_arm
- TOOLSET: MSVC1900
ARCH: amd64_arm

init:
# Carriage returns can be bad
- cmd: git config --global core.autocrlf input

clone_folder: 'c:\%APPVEYOR_PROJECT_NAME%'

# XXX - this will be the root prebuild output folder
# Preserve "PTHREADS-BUILT%APPVEYOR_BUILD_VERSION%" directory in the root of build folder
cache: PTHREADS-BUILT%APPVEYOR_BUILD_VERSION%

install:
# If there's a newer build queued for the same PR, cancel this one
# XXX - change this to "If there's a newer build queued at all"
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }

# - ps: $url="https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/pthreads-win32/artifacts/PTHREADS-BUILT$env:APPVEYOR_BUILD_VERSION.zip"
# - ps: if ($env:ARCH -eq "x86_amd64") {Invoke-WebRequest $env:URL}
# - ps: if ($env:ARCH -eq "x86_amd64") {7z.exe x "PTHREADS-BUILT$env:APPVEYOR_BUILD_VERSION.zip"}
# XXX - fix me!
- cmd: 'if "%ARCH%"=="x86_amd64" appveyor DownloadFile "%URL%" && 7z.exe x PTHREADS-BUILT%APPVEYOR_BUILD_VERSION%.zip > NUL'

# set compiler environment
- cmd: if "%TOOLSET%"=="MSVC1910" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
- cmd: if not "%TOOLSET%"=="MSVC1910" call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %ARCH%

build_script:
- cmd: nmake all
- cmd: nmake install
- cmd: nmake /nologo install DEPLOY=1

test_script:
- cmd: cd tests
- cmd: nmake /nologo clean VC
- cmd: nmake /nologo VC NO_DEPS=1 BUGGY=1 TESTS="exception1 exception2 exception3_0 exception3 sequence1" & exit /b 0
# - cmd: nmake /nologo clean all-tests
# - cmd: nmake /nologo -DEXHAUSTIVE clean all-tests
# Warning: MORE_EXHAUSTIVE takes a few hours to complete!
# - cmd: nmake /nologo -DEXHAUSTIVE clean all-tests MORE_EXHAUSTIVE=1

after_test:
- ps: |
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
bash codecov.sh -f "coverage.xml" -t 1eef4895-a479-44ae-aade-af4d1c5dc286
artifacts:
# IMPORTANT! If the artifact path starts with * surround the value with single quotes.

# WIP: Push the entire PTHREADS-BUILT-{APPVEYOR_BUILD_NUMBER} folder as a single zip archive.
- path: 'PTHREADS-BUILT%APPVEYOR_BUILD_VERSION%'


notifications:
- provider: GitHubPullRequest
auth_token:
secure: VwyaJwle6Sl0AuOebFpGCIXiPyC2aOZjH0MZe+i8YlFib7AcqvDkbZQUqKbVuHK5
template: "{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})"

#
# One day...
#
# deploy:
# Deploying to NuGet feed
# - provider: NuGet
# server: https://my.nuget.server/feed
# api_key:
# secure: FYWX6NfjZIVw==
# skip_symbols: false
# symbol_server: https://your.symbol.server/feed
# artifact: MyPackage.nupkg

# Deploy to GitHub Releases
# - provider: GitHub
# artifact: /.*\.nupkg/ # upload all NuGet packages to release assets
# draft: false
# prerelease: false
# on:
# branch: master # release from master branch only
# appveyor_repo_tag: true # deploy on tag push only
3 changes: 1 addition & 2 deletions contrib/FindPTHREADS-WIN32.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Distributed under the OSI-approved BSD 3-Clause License.
#
# Find the Pthreads library
# This module searches for the Pthreads library (including the
Expand Down
8 changes: 4 additions & 4 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ OPTIM = /O2 /Ob0
XXLIBS = ws2_32.lib

# C++ Exceptions
VCEFLAGS = /EHs /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
VCEFLAGS = /EHs /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX /FI..\winconfig.h
VCELIB = pthreadVCE$(DLL_VER).lib
VCEDLL = pthreadVCE$(DLL_VER).dll
VCELIBD = pthreadVCE$(DLL_VER)d.lib
Expand All @@ -61,13 +61,13 @@ VSEDLL = pthreadVSE$(DLL_VER).dll
VSELIBD = pthreadVSE$(DLL_VER)d.lib
VSEDLLD = pthreadVSE$(DLL_VER)d.dll
# C cleanup code
VCFLAGS = /D__CLEANUP_C
VCFLAGS = /D__CLEANUP_C /FI..\winconfig.h
VCLIB = pthreadVC$(DLL_VER).lib
VCDLL = pthreadVC$(DLL_VER).dll
VCLIBD = pthreadVC$(DLL_VER)d.lib
VCDLLD = pthreadVC$(DLL_VER)d.dll
# C++ Exceptions in application - using VC version of pthreads dll
VCXFLAGS = /EHs /TP /D__CLEANUP_C
VCXFLAGS = /EHs /TP /D__CLEANUP_C /FI..\winconfig.h

# Defaults
CPLIB = $(VCLIB)
Expand Down Expand Up @@ -222,7 +222,7 @@ clean:
@if exist *.log $(RM) *.log

.c.pass:
$(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $*.c /Fe$*.exe /link $(LFLAGS) $(CPLIB) $(XXLIBS)
@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $*.c /Fe$*.exe /link $(LFLAGS) $(CPLIB) $(XXLIBS)
@ $(ECHO) ... Running $(TEST) test: $*.exe
@ .\$*.exe
@ $(ECHO) ...... Passed
Expand Down
2 changes: 2 additions & 0 deletions tests/benchlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
*
*/

#ifndef _MSC_VER
#include "../config.h"
#endif

#include "pthread.h"
#include "sched.h"
Expand Down
2 changes: 2 additions & 0 deletions tests/benchtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
*
*/

#ifndef _MSC_VER
#include "../config.h"
#endif

enum {
OLD_WIN32CS,
Expand Down
6 changes: 6 additions & 0 deletions tests/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ ALL_KNOWN_TESTS = \
detach1 \
equal1 \
errno1 \
# XXX - fix me!
!IF DEFINED(BUGGY)
exception1 exception2 exception3_0 exception3 \
!ENDIF
exit1 exit2 exit3 exit4 exit5 exit6 \
eyal1 \
join0 join1 join2 join3 join4 \
Expand All @@ -43,7 +46,10 @@ ALL_KNOWN_TESTS = \
self1 self2 \
semaphore1 semaphore2 semaphore3 \
semaphore4 semaphore4t semaphore5 \
# XXX - fix me!
!IF DEFINED(BUGGY)
sequence1 \
!ENDIF
sizes \
spin1 spin2 spin3 spin4 \
stress1 threestage \
Expand Down
3 changes: 3 additions & 0 deletions tests/condvar2.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ pthread_cond_t cv;
pthread_mutex_t mutex;

/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"

int
Expand Down
3 changes: 3 additions & 0 deletions tests/condvar2_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ mythread(void * arg)
}

/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"

int
Expand Down
3 changes: 3 additions & 0 deletions tests/condvar3_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ mythread(void * arg)
}

/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"

int
Expand Down
3 changes: 3 additions & 0 deletions tests/condvar3_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ mythread(void * arg)
}

/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"

int
Expand Down
3 changes: 3 additions & 0 deletions tests/context1.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@

#include "test.h"
/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"
#include "../context.h"

Expand Down
3 changes: 3 additions & 0 deletions tests/context2.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@

#include "test.h"
/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"
#include "../context.h"

Expand Down
3 changes: 3 additions & 0 deletions tests/sizes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

#include "test.h"
/* Cheating here - sneaking a peek at library internals */
#ifndef _MSC_VER
#include "../config.h"
#endif

#include "../implement.h"

int
Expand Down

0 comments on commit a680a9f

Please sign in to comment.