Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
helje5 committed Jan 3, 2021
2 parents 3501358 + 1fd8e32 commit d2f21eb
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 35 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 28 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import XCTest
@testable import mustacheTests

var tests = [XCTestCaseEntry]()
tests += MustacheTests.allTests()
tests += mustacheTests.allTests()
XCTMain(tests)
24 changes: 12 additions & 12 deletions Tests/mustacheTests/MustacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -174,15 +174,15 @@ 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])

XCTAssertEqual(result, fixFullNameKVCResults1)
}

func testStructKVCRendering() {
func testStructKVCRendering() throws {
let parser = MustacheParser()
let tree = parser.parse(string: fixFullNameKVCTemplate1)
let result = tree.render(object: ["persons": fixUsersClass])
Expand Down Expand Up @@ -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 )
]
}
4 changes: 2 additions & 2 deletions Tests/mustacheTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions mustache.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -189,7 +189,7 @@
};
buildConfigurationList = E83AF8F31E3E40500039F300 /* Build configuration list for PBXProject "mustache" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -270,6 +270,7 @@
buildSettings = {
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
};
Expand Down
28 changes: 12 additions & 16 deletions mustache.xcodeproj/xcshareddata/xcschemes/mustache.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
systemAttachmentLifetime = "keepNever"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
systemAttachmentLifetime = "keepNever">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E83AF8F71E3E40500039F300"
BuildableName = "libmustache.dylib"
BlueprintName = "mustache"
ReferencedContainer = "container:mustache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -40,17 +49,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E83AF8F71E3E40500039F300"
BuildableName = "libmustache.dylib"
BlueprintName = "mustache"
ReferencedContainer = "container:mustache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
Expand All @@ -71,8 +69,6 @@
ReferencedContainer = "container:mustache.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 2 additions & 0 deletions xcconfig/config.make
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions xcconfig/docker.make
Original file line number Diff line number Diff line change
@@ -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)"

0 comments on commit d2f21eb

Please # to comment.