From abe7099e7282cae67fd50098e6c265e5ebb7ca78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Wed, 8 Jan 2020 17:56:21 +0100 Subject: [PATCH 1/5] Xcode upgrade marker ... --- mustache.xcodeproj/project.pbxproj | 7 +++-- .../xcshareddata/xcschemes/mustache.xcscheme | 28 ++++++++----------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mustache.xcodeproj/project.pbxproj b/mustache.xcodeproj/project.pbxproj index c16ec7b..c4a3120 100644 --- a/mustache.xcodeproj/project.pbxproj +++ b/mustache.xcodeproj/project.pbxproj @@ -171,13 +171,13 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = "ZeeZide GmbH"; TargetAttributes = { E83AF8F71E3E40500039F300 = { CreatedOnToolsVersion = 8.2.1; DevelopmentTeam = 4GXF3JAMM4; - LastSwiftMigration = 1020; + LastSwiftMigration = 1100; ProvisioningStyle = Automatic; }; E8AFFF3D1E6F11B50074266E = { @@ -189,7 +189,7 @@ }; buildConfigurationList = E83AF8F31E3E40500039F300 /* Build configuration list for PBXProject "mustache" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -270,6 +270,7 @@ buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; + SWIFT_COMPILATION_MODE = wholemodule; }; name = Release; }; diff --git a/mustache.xcodeproj/xcshareddata/xcschemes/mustache.xcscheme b/mustache.xcodeproj/xcshareddata/xcschemes/mustache.xcscheme index 616c0e0..61d1424 100644 --- a/mustache.xcodeproj/xcshareddata/xcschemes/mustache.xcscheme +++ b/mustache.xcodeproj/xcshareddata/xcschemes/mustache.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES" + systemAttachmentLifetime = "keepNever"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - Date: Wed, 25 Mar 2020 00:50:42 +0100 Subject: [PATCH 2/5] Travis: Build against 5.2 ... will it work? Also add Xcode 11. --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b46022..afa83bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,10 @@ matrix: dist: trusty env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz" sudo: required + - os: Linux + dist: xenial + env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-5.2-release/ubuntu1604/swift-5.2-RELEASE/swift-5.2-RELEASE-ubuntu16.04.tar.gz" + sudo: required - os: osx osx_image: xcode8.3 - os: osx @@ -39,7 +43,8 @@ matrix: osx_image: xcode10.1 - os: osx osx_image: xcode10.2 - + - os: osx + osx_image: xcode11 before_install: - ./.travis.d/before-install.sh From 44dbf4669543fa85877ffa3fe152e5434e890db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Sun, 3 Jan 2021 17:38:33 +0100 Subject: [PATCH 3/5] GH: Add a workflow ... --- .github/workflows/swift.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..5d9931b --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,45 @@ +name: Build and Test + +on: + push: + pull_request: + schedule: + - cron: "0 9 * * 1" + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + image: + - swift:5.0.3-xenial + - swift:5.1.5-xenial + - swift:5.2.5-xenial + - swift:5.3.2-xenial + - swift:5.3.2-bionic + container: ${{ matrix.image }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build Swift Debug Package + run: swift build -c debug + - name: Build Swift Release Package + run: swift build -c release + - name: Run Tests + run: swift test + nextstep: + runs-on: macos-latest + steps: + - name: Select latest available Xcode + uses: maxim-lobanov/setup-xcode@v1.2.1 + with: + xcode-version: 12.2 + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Build Swift Debug Package + run: swift build -c debug + - name: Build Swift Release Package + run: swift build -c release + - name: Run Tests + run: swift test From 33093d81de2c5069d60c00e31347aa99879f4741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Sun, 3 Jan 2021 18:44:33 +0100 Subject: [PATCH 4/5] Fix test setup Was using a confusing mismatch of upper/lowercase, which b0rks on real OS'es. --- Tests/LinuxMain.swift | 2 +- Tests/mustacheTests/MustacheTests.swift | 24 +++++++++++------------ Tests/mustacheTests/XCTestManifests.swift | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index fa0ef75..5098fad 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -3,5 +3,5 @@ import XCTest @testable import mustacheTests var tests = [XCTestCaseEntry]() -tests += MustacheTests.allTests() +tests += mustacheTests.allTests() XCTMain(tests) diff --git a/Tests/mustacheTests/MustacheTests.swift b/Tests/mustacheTests/MustacheTests.swift index e1cdcf4..57d3717 100644 --- a/Tests/mustacheTests/MustacheTests.swift +++ b/Tests/mustacheTests/MustacheTests.swift @@ -3,14 +3,14 @@ // Noze.io // // Created by Helge Heß on 6/1/16. -// Copyright © 2016 ZeeZide GmbH. All rights reserved. +// Copyright © 2016-2020 ZeeZide GmbH. All rights reserved. // import XCTest @testable import mustache -public class PersonClass { +public class PersonClass: NSObject { // NSObject is required on Linux var firstname : String var lastname : String @@ -174,7 +174,7 @@ class MustacheTests: XCTestCase { XCTAssertEqual(result, fixTaxTemplate2) } - func testClassKVCRendering() { + func testClassKVCRendering() throws { let parser = MustacheParser() let tree = parser.parse(string: fixFullNameKVCTemplate1) let result = tree.render(object: ["persons": fixUsersClass]) @@ -182,7 +182,7 @@ class MustacheTests: XCTestCase { XCTAssertEqual(result, fixFullNameKVCResults1) } - func testStructKVCRendering() { + func testStructKVCRendering() throws { let parser = MustacheParser() let tree = parser.parse(string: fixFullNameKVCTemplate1) let result = tree.render(object: ["persons": fixUsersClass]) @@ -270,14 +270,14 @@ class MustacheTests: XCTestCase { static var allTests = [ ( "testSimpleMustacheDict", testSimpleMustacheDict ), - ( "testDictKVC", testDictKVC ), - ( "testDictNumberKVC", testDictNumberKVC ), - ( "testTreeRendering", testTreeRendering ), - ( "testClassKVCRendering", testClassKVCRendering ), + ( "testDictKVC" , testDictKVC ), + ( "testDictNumberKVC" , testDictNumberKVC ), + ( "testTreeRendering" , testTreeRendering ), + ( "testClassKVCRendering" , testClassKVCRendering ), ( "testStructKVCRendering", testStructKVCRendering ), - ( "testLambda", testLambda ), - ( "testSimpleLambda", testSimpleLambda ), - ( "testPartialParsing", testPartialParsing ), - ( "testPartial", testPartial ), + ( "testLambda" , testLambda ), + ( "testSimpleLambda" , testSimpleLambda ), + ( "testPartialParsing" , testPartialParsing ), + ( "testPartial" , testPartial ) ] } diff --git a/Tests/mustacheTests/XCTestManifests.swift b/Tests/mustacheTests/XCTestManifests.swift index 7f78aae..af07ab8 100644 --- a/Tests/mustacheTests/XCTestManifests.swift +++ b/Tests/mustacheTests/XCTestManifests.swift @@ -1,9 +1,9 @@ import XCTest #if !canImport(ObjectiveC) -public func allTests() -> [XCTestCaseEntry] { +public func allTests() -> [ XCTestCaseEntry ] { return [ - testCase(mustacheTests.allTests), + testCase(MustacheTests.allTests) ] } #endif From 1fd8e325bc6a03f95067c078e042ca83f9480b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20He=C3=9F?= Date: Sun, 3 Jan 2021 18:45:01 +0100 Subject: [PATCH 5/5] Add some Docker test stuff to makefile ... the makefile is for Swift 2 really, but lets add the stuff we need to make it run on Docker. --- GNUmakefile | 28 ++++++++++++++++++++++++++++ xcconfig/config.make | 2 ++ xcconfig/docker.make | 15 +++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 xcconfig/docker.make diff --git a/GNUmakefile b/GNUmakefile index 792cbd7..0890cff 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -37,3 +37,31 @@ clean : distclean : clean endif + +# Docker stuff + +include $(PACKAGE_DIR)/xcconfig/docker.make + +SWIFT_SOURCES = Sources/*/*.swift + +$(DOCKER_BUILD_PRODUCT): $(SWIFT_SOURCES) + $(DOCKER) run --rm -it \ + -v "$(PWD):/src" \ + -v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \ + "$(SWIFT_BUILD_IMAGE)" \ + bash -c 'cd /src && swift build -c $(CONFIGURATION)' + +docker-all: $(DOCKER_BUILD_PRODUCT) + +docker-test: docker-all + $(DOCKER) run --rm -it \ + -v "$(PWD):/src" \ + -v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \ + "$(SWIFT_BUILD_IMAGE)" \ + bash -c 'cd /src && swift test -c $(CONFIGURATION)' + +docker-clean: + rm $(DOCKER_BUILD_PRODUCT) + +docker-distclean: + rm -rf $(DOCKER_BUILD_DIR) diff --git a/xcconfig/config.make b/xcconfig/config.make index 26a0ba4..65e0b64 100644 --- a/xcconfig/config.make +++ b/xcconfig/config.make @@ -102,6 +102,7 @@ SWIFT_INTERNAL_TEST_FLAGS := # $(SWIFT_INTERNAL_BUILD_FLAGS) # Debug or Release? ifeq ($(debug),on) + CONFIGURATION=debug APXS_EXTRA_CFLAGS += -g APXS_EXTRA_LDFLAGS += -g @@ -113,6 +114,7 @@ ifeq ($(debug),on) SWIFT_REL_BUILD_DIR=.libs endif else + CONFIGURATION=release ifeq ($(USE_SPM),yes) SWIFT_INTERNAL_BUILD_FLAGS += --configuration release SWIFT_REL_BUILD_DIR=.build/release diff --git a/xcconfig/docker.make b/xcconfig/docker.make new file mode 100644 index 0000000..012f4f3 --- /dev/null +++ b/xcconfig/docker.make @@ -0,0 +1,15 @@ +# GNUmakefile + +# docker config + +DOCKER=docker + +#SWIFT_BUILD_IMAGE="swift:5.2.4" +#SWIFT_BUILD_IMAGE="swift:5.1.3" +#SWIFT_BUILD_IMAGE="ang/swift:nightly-5.3-bionic" +#SWIFT_BUILD_IMAGE="swiftlang/swift:nightly-5.3-xenial" +SWIFT_BUILD_IMAGE="swift:5.3.1" + +DOCKER_BUILD_DIR=".docker$(SWIFT_BUILD_DIR)" +SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/x86_64-unknown-linux/$(CONFIGURATION)" +DOCKER_BUILD_PRODUCT="$(DOCKER_BUILD_DIR)/$(TOOL_NAME)"