From 3a0f8a8dd92af9a5b122facaa8f4cc572fa7747f Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 13 Jan 2021 10:40:28 +0000 Subject: [PATCH] Build the GTK renderer on Ubuntu on CI (#347) * Build the GTK renderer on Ubuntu on CI * Add `--enable-test-discovery` flag to `Makefile` * Use OpenCombine branch w/ no Runtime dependency * Run `sudo apt-get update` on Ubuntu hosts * Update OpenCombine dependency * Pin OpenCombineJS dependency * Update label.yml --- .github/workflows/ci.yml | 28 +++++++++++++++++++ .github/workflows/label.yml | 2 +- Makefile | 2 +- Package.resolved | 8 +++--- Package.swift | 4 +-- .../MountedViews/MountedElement.swift | 10 +++---- .../MountedViews/MountedScene.swift | 2 +- .../TokamakCore/Views/Selectors/Picker.swift | 2 +- Sources/TokamakDemo/ColorDemo.swift | 4 +-- .../Modifiers/LayoutModifiers.swift | 2 +- Sources/TokamakGTK/Widget.swift | 4 +-- .../Modifiers/ModifiedContent.swift | 2 +- 12 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71f08f210..4c868ff9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,3 +57,31 @@ jobs: brew install gtk+3 make build + + gtk_ubuntu_18_04_build: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Build the GTK renderer on Ubuntu 18.04 + shell: bash + run: | + set -ex + sudo apt-get update + sudo apt-get install libgtk+-3.0 gtk+-3.0 + + make build + + gtk_ubuntu_20_04_build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - name: Build the GTK renderer on Ubuntu 20.04 + shell: bash + run: | + set -ex + sudo apt-get update + sudo apt-get install libgtk+-3.0 gtk+-3.0 + + make build diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 1699e4084..03278f51d 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,7 +11,7 @@ on: jobs: check-labels: # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Match PR Label diff --git a/Makefile b/Makefile index 8b701c683..8e59d353c 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SWIFT_C_FLAGS ?= -Xcc $(shell echo $(C_FLAGS) | sed -e "s/ / -Xcc /g") all: build build: - swift build --product TokamakGTKDemo $(SWIFT_C_FLAGS) $(SWIFT_LINKER_FLAGS) + swift build --enable-test-discovery --product TokamakGTKDemo $(SWIFT_C_FLAGS) $(SWIFT_LINKER_FLAGS) run: build .build/debug/TokamakGTKDemo diff --git a/Package.resolved b/Package.resolved index 710aa97f1..0749d2c75 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/TokamakUI/OpenCombine.git", "state": { "branch": null, - "revision": "bccff3e7c84bc559e1aa0aa9ca878400360d439d", - "version": "0.12.0-alpha2" + "revision": "eea5e707b571da14fce588000046b8ec4c62018b", + "version": "0.12.0-alpha3" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/swiftwasm/OpenCombineJS.git", "state": { "branch": null, - "revision": "b346f955ed21ab44576e204a7554210c77f69b9b", - "version": "0.0.1" + "revision": "5e8636b15bcb4b8900696d95daaab941458ed2cf", + "version": "0.0.2" } }, { diff --git a/Package.swift b/Package.swift index 3ea083aad..1d0cdf447 100644 --- a/Package.swift +++ b/Package.swift @@ -50,8 +50,8 @@ let package = Package( .upToNextMinor(from: "0.9.0") ), .package(url: "https://github.com/MaxDesiatov/Runtime.git", from: "2.1.2"), - .package(url: "https://github.com/TokamakUI/OpenCombine.git", from: "0.12.0-alpha2"), - .package(url: "https://github.com/swiftwasm/OpenCombineJS.git", from: "0.0.1"), + .package(url: "https://github.com/TokamakUI/OpenCombine.git", from: "0.12.0-alpha3"), + .package(url: "https://github.com/swiftwasm/OpenCombineJS.git", .upToNextMinor(from: "0.0.2")), ], targets: [ // Targets are the basic building blocks of a package. A target can define diff --git a/Sources/TokamakCore/MountedViews/MountedElement.swift b/Sources/TokamakCore/MountedViews/MountedElement.swift index 3be326ba8..0696991f1 100644 --- a/Sources/TokamakCore/MountedViews/MountedElement.swift +++ b/Sources/TokamakCore/MountedViews/MountedElement.swift @@ -76,10 +76,10 @@ public class MountedElement { var typeConstructorName: String { switch element { case .app: fatalError(""" - `App` values aren't supposed to be reconciled, thus the type constructor name is not stored \ - for `App` elements. Please report this crash as a bug at \ - https://github.com/swiftwasm/Tokamak/issues/new - """) + `App` values aren't supposed to be reconciled, thus the type constructor name is not stored \ + for `App` elements. Please report this crash as a bug at \ + https://github.com/swiftwasm/Tokamak/issues/new + """) case let .scene(scene): return scene.typeConstructorName case let .view(view): return view.typeConstructorName } @@ -172,7 +172,7 @@ extension TypeInfo { // swiftlint:disable force_try // Extract the view from the AnyView for modification, apply Environment changes: if genericTypes.contains(where: { $0 is EnvironmentModifier.Type }), - let modifier = try! property(named: "modifier").get(from: element) as? EnvironmentModifier + let modifier = try! property(named: "modifier").get(from: element) as? EnvironmentModifier { modifier.modifyEnvironment(&modifiedEnv) } diff --git a/Sources/TokamakCore/MountedViews/MountedScene.swift b/Sources/TokamakCore/MountedViews/MountedScene.swift index bd477ebd3..b1327e3c1 100644 --- a/Sources/TokamakCore/MountedViews/MountedScene.swift +++ b/Sources/TokamakCore/MountedViews/MountedScene.swift @@ -99,7 +99,7 @@ extension _AnyScene { ) -> MountedScene { var title: String? if let titledSelf = scene as? TitledScene, - let text = titledSelf.title + let text = titledSelf.title { title = _TextProxy(text).rawText } diff --git a/Sources/TokamakCore/Views/Selectors/Picker.swift b/Sources/TokamakCore/Views/Selectors/Picker.swift index 05887b8b0..3ce52c50e 100644 --- a/Sources/TokamakCore/Views/Selectors/Picker.swift +++ b/Sources/TokamakCore/Views/Selectors/Picker.swift @@ -76,7 +76,7 @@ public struct Picker: View // update the binding. ForEach(0..: View, AnyWidget, ParentView { let build: (UnsafeMutablePointer) -> UnsafeMutablePointer - let update: (Widget) -> Void + let update: (Widget) -> () let content: Content let expand: Bool init(build: @escaping (UnsafeMutablePointer) -> UnsafeMutablePointer, - update: @escaping (Widget) -> Void = { _ in }, + update: @escaping (Widget) -> () = { _ in }, expand: Bool = false, @ViewBuilder content: () -> Content) { diff --git a/Sources/TokamakStaticHTML/Modifiers/ModifiedContent.swift b/Sources/TokamakStaticHTML/Modifiers/ModifiedContent.swift index df6ed2752..558a6a77f 100644 --- a/Sources/TokamakStaticHTML/Modifiers/ModifiedContent.swift +++ b/Sources/TokamakStaticHTML/Modifiers/ModifiedContent.swift @@ -34,7 +34,7 @@ extension ModifiedContent: ViewDeferredToRenderer where Content: View, Modifier: public var deferredBody: AnyView { if let domModifier = modifier as? DOMViewModifier { if let adjacentModifier = content as? AnyModifiedContent, - !(adjacentModifier.anyModifier.isOrderDependent || domModifier.isOrderDependent) + !(adjacentModifier.anyModifier.isOrderDependent || domModifier.isOrderDependent) { // Flatten non-order-dependent modifiers var attr = domModifier.attributes