Skip to content

Commit fd64eaf

Browse files
authored
Build and test with SwiftWasm 5.6 on CI (#475)
Had to drop support for Swift 5.4/5.5 and macOS 5.6 jobs, see #475 (comment) for more details. Linux builds and `codecov` job were updated to use nightly Swift, which have crashes reproducible in 5.6.0 release fixed. Also applied a few formatting changes with the latest SwiftFormat.
1 parent eef6bb2 commit fd64eaf

File tree

23 files changed

+185
-214
lines changed

23 files changed

+185
-214
lines changed

.github/workflows/ci.yml

+67-82
Original file line numberDiff line numberDiff line change
@@ -6,121 +6,106 @@ on:
66
branches: [main]
77

88
jobs:
9-
swiftwasm_bundle_5_4:
9+
swiftwasm_bundle_5_6:
1010
runs-on: ubuntu-20.04
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: swiftwasm/swiftwasm-action@v5.4
14+
- uses: swiftwasm/swiftwasm-action@main
1515
with:
1616
shell-action: carton bundle --product TokamakDemo
1717

18-
swiftwasm_test_5_4:
18+
swiftwasm_test_5_6:
1919
runs-on: ubuntu-20.04
2020

2121
steps:
2222
- uses: actions/checkout@v2
23-
- uses: swiftwasm/swiftwasm-action@v5.4
23+
- uses: swiftwasm/swiftwasm-action@main
2424
with:
2525
shell-action: carton test
2626

27-
swiftwasm_bundle_5_5:
28-
runs-on: ubuntu-20.04
29-
30-
steps:
31-
- uses: actions/checkout@v2
32-
- uses: swiftwasm/swiftwasm-action@v5.5
33-
with:
34-
shell-action: carton bundle --product TokamakDemo
35-
36-
swiftwasm_test_5_5:
37-
runs-on: ubuntu-20.04
38-
39-
steps:
40-
- uses: actions/checkout@v2
41-
- uses: swiftwasm/swiftwasm-action@v5.5
42-
with:
43-
shell-action: carton test
44-
45-
core_macos_build:
46-
runs-on: macos-11
47-
48-
steps:
49-
- uses: actions/checkout@v2
50-
- name: Run the test suite on macOS, build the demo project for iOS
51-
shell: bash
52-
run: |
53-
set -ex
54-
sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
55-
# avoid building unrelated products for testing by specifying the test product explicitly
56-
swift build --product TokamakPackageTests
57-
`xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
58-
(cp -r /var/folders/*/*/*/*Tests . ; exit 1)
59-
60-
rm -rf Sources/TokamakGTKCHelpers/*.c
61-
62-
xcodebuild -version
63-
64-
# Make sure Tokamak can be built on macOS so that Xcode autocomplete works.
65-
# Disable macOS builds until Monterey is available on GHA.
66-
# xcodebuild -scheme TokamakDemo -destination 'generic/platform=macOS' \
67-
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
68-
# xcpretty --color
69-
70-
cd "NativeDemo"
71-
xcodebuild -scheme iOS -destination 'generic/platform=iOS' \
72-
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
73-
xcpretty --color
74-
cd ..
75-
76-
./benchmark.sh
77-
78-
- name: Upload failed snapshots
79-
uses: actions/upload-artifact@v2
80-
if: ${{ failure() }}
81-
with:
82-
name: Failed snapshots
83-
path: '*Tests'
84-
85-
gtk_macos_build:
86-
runs-on: macos-11
87-
88-
steps:
89-
- uses: actions/checkout@v2
90-
- name: Build the GTK renderer on macOS
91-
shell: bash
92-
run: |
93-
set -ex
94-
sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
95-
96-
brew install gtk+3
97-
98-
make build
27+
# Disabled until macos-12 is available on GitHub Actions, which is required for Xcode 13.3
28+
# core_macos_build:
29+
# runs-on: macos-11
30+
31+
# steps:
32+
# - uses: actions/checkout@v2
33+
# - name: Run the test suite on macOS, build the demo project for iOS
34+
# shell: bash
35+
# run: |
36+
# set -ex
37+
# sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
38+
# # avoid building unrelated products for testing by specifying the test product explicitly
39+
# swift build --product TokamakPackageTests
40+
# `xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
41+
# (cp -r /var/folders/*/*/*/*Tests . ; exit 1)
42+
43+
# rm -rf Sources/TokamakGTKCHelpers/*.c
44+
45+
# xcodebuild -version
46+
47+
# # Make sure Tokamak can be built on macOS so that Xcode autocomplete works.
48+
# # Disable macOS builds until Monterey is available on GHA.
49+
# # xcodebuild -scheme TokamakDemo -destination 'generic/platform=macOS' \
50+
# # CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
51+
# # xcpretty --color
52+
53+
# cd "NativeDemo"
54+
# xcodebuild -scheme iOS -destination 'generic/platform=iOS' \
55+
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
56+
# xcpretty --color
57+
# cd ..
58+
59+
# ./benchmark.sh
60+
61+
# - name: Upload failed snapshots
62+
# uses: actions/upload-artifact@v2
63+
# if: ${{ failure() }}
64+
# with:
65+
# name: Failed snapshots
66+
# path: '*Tests'
67+
68+
# gtk_macos_build:
69+
# runs-on: macos-11
70+
71+
# steps:
72+
# - uses: actions/checkout@v2
73+
# - name: Build the GTK renderer on macOS
74+
# shell: bash
75+
# run: |
76+
# set -ex
77+
# sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
78+
79+
# brew install gtk+3
80+
81+
# make build
9982

10083
gtk_ubuntu_18_04_build:
101-
runs-on: ubuntu-18.04
84+
runs-on: ubuntu-latest
85+
container:
86+
image: swiftlang/swift:nightly-bionic
10287

10388
steps:
10489
- uses: actions/checkout@v2
10590
- name: Build the GTK renderer on Ubuntu 18.04
10691
shell: bash
10792
run: |
10893
set -ex
109-
sudo apt-get update
110-
sudo apt-get install libgtk+-3.0 gtk+-3.0
94+
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libgtk+-3.0 gtk+-3.0
11195
11296
make build
11397
11498
gtk_ubuntu_20_04_build:
115-
runs-on: ubuntu-20.04
99+
runs-on: ubuntu-latest
100+
container:
101+
image: swiftlang/swift:nightly-focal
116102

117103
steps:
118104
- uses: actions/checkout@v2
119105
- name: Build the GTK renderer on Ubuntu 20.04
120106
shell: bash
121107
run: |
122108
set -ex
123-
sudo apt-get update
124-
sudo apt-get install libgtk+-3.0 gtk+-3.0
109+
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libgtk+-3.0 gtk+-3.0
125110
126111
make build

.github/workflows/codecov.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Codecov
32

43
on:
@@ -9,21 +8,21 @@ on:
98
jobs:
109
codecov:
1110
container:
12-
image: swift:5.4-bionic
11+
image: swiftlang/swift:nightly-focal
1312
runs-on: ubuntu-latest
1413
steps:
15-
- run: apt-get update && apt-get install -y gtk+-3.0 libgtk+-3.0
14+
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0
1615
- name: Checkout Branch
1716
uses: actions/checkout@v2
1817
- name: Build Test Target
19-
run: swift build --enable-test-discovery -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
18+
run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
2019
- name: Run Tests
21-
run: swift test --enable-test-discovery --enable-code-coverage --skip-build
20+
run: swift test --enable-code-coverage --skip-build
2221
- name: Generate Branch Coverage Report
23-
uses: mattpolzin/swift-codecov-action@0.6.1
22+
uses: mattpolzin/swift-codecov-action@0.7.1
2423
id: cov
2524
with:
26-
MINIMUM_COVERAGE: 20
25+
MINIMUM_COVERAGE: 15
2726
- name: Post Positive Results
2827
if: ${{ success() }}
2928
run: |
@@ -32,4 +31,3 @@ jobs:
3231
if: ${{ failure() }}
3332
run: |
3433
echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)."
35-

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ Pods/
4141
# SwiftPM
4242
.build
4343
/Packages
44+
45+
# VS Code
46+
.vscode/launch.json

.swift-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wasm-5.6.0-RELEASE

.vscode/launch.json

-17
This file was deleted.

Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"repositoryURL": "https://github.com/swiftwasm/JavaScriptKit.git",
77
"state": {
88
"branch": null,
9-
"revision": "6c31bad4b1ef18385262f5154845648c8c95ae94",
10-
"version": "0.12.0"
9+
"revision": "9a3b7d5f316e6d1709bd25e3e0392efca357f525",
10+
"version": "0.14.0"
1111
}
1212
},
1313
{

Package.swift

+24-33
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,7 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version:5.6
22

33
import PackageDescription
44

5-
var tokamakDOMDependencies: [Target.Dependency] = [
6-
"TokamakCore",
7-
"TokamakStaticHTML",
8-
.product(
9-
name: "OpenCombineShim",
10-
package: "OpenCombine"
11-
),
12-
.product(
13-
name: "JavaScriptKit",
14-
package: "JavaScriptKit",
15-
condition: .when(platforms: [.wasi])
16-
),
17-
"OpenCombineJS",
18-
]
19-
20-
#if compiler(>=5.5) && (canImport(Concurrency) || canImport(_Concurrency))
21-
tokamakDOMDependencies.append(
22-
.product(
23-
name: "JavaScriptEventLoop",
24-
package: "JavaScriptKit",
25-
condition: .when(platforms: [.wasi])
26-
)
27-
)
28-
#endif
29-
305
let package = Package(
316
name: "Tokamak",
327
platforms: [
@@ -72,7 +47,7 @@ let package = Package(
7247
dependencies: [
7348
.package(
7449
url: "https://github.com/swiftwasm/JavaScriptKit.git",
75-
.upToNextMinor(from: "0.12.0")
50+
.upToNextMinor(from: "0.14.0")
7651
),
7752
.package(
7853
url: "https://github.com/OpenCombine/OpenCombine.git",
@@ -83,12 +58,10 @@ let package = Package(
8358
.upToNextMinor(from: "0.1.2")
8459
),
8560
.package(
86-
name: "Benchmark",
8761
url: "https://github.com/google/swift-benchmark",
8862
from: "0.1.0"
8963
),
9064
.package(
91-
name: "SnapshotTesting",
9265
url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
9366
from: "1.9.0"
9467
),
@@ -160,20 +133,38 @@ let package = Package(
160133
.executableTarget(
161134
name: "TokamakCoreBenchmark",
162135
dependencies: [
163-
"Benchmark",
136+
.product(name: "Benchmark", package: "swift-benchmark"),
164137
"TokamakCore",
165138
]
166139
),
167140
.executableTarget(
168141
name: "TokamakStaticHTMLBenchmark",
169142
dependencies: [
170-
"Benchmark",
143+
.product(name: "Benchmark", package: "swift-benchmark"),
171144
"TokamakStaticHTML",
172145
]
173146
),
174147
.target(
175148
name: "TokamakDOM",
176-
dependencies: tokamakDOMDependencies
149+
dependencies: [
150+
"TokamakCore",
151+
"TokamakStaticHTML",
152+
.product(
153+
name: "OpenCombineShim",
154+
package: "OpenCombine"
155+
),
156+
.product(
157+
name: "JavaScriptKit",
158+
package: "JavaScriptKit",
159+
condition: .when(platforms: [.wasi])
160+
),
161+
.product(
162+
name: "JavaScriptEventLoop",
163+
package: "JavaScriptKit",
164+
condition: .when(platforms: [.wasi])
165+
),
166+
"OpenCombineJS",
167+
]
177168
),
178169
.executableTarget(
179170
name: "TokamakDemo",
@@ -213,7 +204,7 @@ let package = Package(
213204
"TokamakStaticHTML",
214205
.product(
215206
name: "SnapshotTesting",
216-
package: "SnapshotTesting",
207+
package: "swift-snapshot-testing",
217208
condition: .when(platforms: [.macOS])
218209
),
219210
],

0 commit comments

Comments
 (0)