Skip to content

Commit

Permalink
Build and test with SwiftWasm 5.6 on CI (#475)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaxDesiatov authored Apr 8, 2022
1 parent eef6bb2 commit fd64eaf
Show file tree
Hide file tree
Showing 23 changed files with 185 additions and 214 deletions.
149 changes: 67 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,121 +6,106 @@ on:
branches: [main]

jobs:
swiftwasm_bundle_5_4:
swiftwasm_bundle_5_6:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/swiftwasm-action@v5.4
- uses: swiftwasm/swiftwasm-action@main
with:
shell-action: carton bundle --product TokamakDemo

swiftwasm_test_5_4:
swiftwasm_test_5_6:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/swiftwasm-action@v5.4
- uses: swiftwasm/swiftwasm-action@main
with:
shell-action: carton test

swiftwasm_bundle_5_5:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/[email protected]
with:
shell-action: carton bundle --product TokamakDemo

swiftwasm_test_5_5:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: swiftwasm/[email protected]
with:
shell-action: carton test

core_macos_build:
runs-on: macos-11

steps:
- uses: actions/checkout@v2
- name: Run the test suite on macOS, build the demo project for iOS
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
# avoid building unrelated products for testing by specifying the test product explicitly
swift build --product TokamakPackageTests
`xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
(cp -r /var/folders/*/*/*/*Tests . ; exit 1)
rm -rf Sources/TokamakGTKCHelpers/*.c
xcodebuild -version
# Make sure Tokamak can be built on macOS so that Xcode autocomplete works.
# Disable macOS builds until Monterey is available on GHA.
# xcodebuild -scheme TokamakDemo -destination 'generic/platform=macOS' \
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
# xcpretty --color
cd "NativeDemo"
xcodebuild -scheme iOS -destination 'generic/platform=iOS' \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
xcpretty --color
cd ..
./benchmark.sh
- name: Upload failed snapshots
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: Failed snapshots
path: '*Tests'

gtk_macos_build:
runs-on: macos-11

steps:
- uses: actions/checkout@v2
- name: Build the GTK renderer on macOS
shell: bash
run: |
set -ex
sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
brew install gtk+3
make build
# Disabled until macos-12 is available on GitHub Actions, which is required for Xcode 13.3
# core_macos_build:
# runs-on: macos-11

# steps:
# - uses: actions/checkout@v2
# - name: Run the test suite on macOS, build the demo project for iOS
# shell: bash
# run: |
# set -ex
# sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/
# # avoid building unrelated products for testing by specifying the test product explicitly
# swift build --product TokamakPackageTests
# `xcrun --find xctest` .build/debug/TokamakPackageTests.xctest ||
# (cp -r /var/folders/*/*/*/*Tests . ; exit 1)

# rm -rf Sources/TokamakGTKCHelpers/*.c

# xcodebuild -version

# # Make sure Tokamak can be built on macOS so that Xcode autocomplete works.
# # Disable macOS builds until Monterey is available on GHA.
# # xcodebuild -scheme TokamakDemo -destination 'generic/platform=macOS' \
# # CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
# # xcpretty --color

# cd "NativeDemo"
# xcodebuild -scheme iOS -destination 'generic/platform=iOS' \
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | \
# xcpretty --color
# cd ..

# ./benchmark.sh

# - name: Upload failed snapshots
# uses: actions/upload-artifact@v2
# if: ${{ failure() }}
# with:
# name: Failed snapshots
# path: '*Tests'

# gtk_macos_build:
# runs-on: macos-11

# steps:
# - uses: actions/checkout@v2
# - name: Build the GTK renderer on macOS
# shell: bash
# run: |
# set -ex
# sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer/

# brew install gtk+3

# make build

gtk_ubuntu_18_04_build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-bionic

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
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libgtk+-3.0 gtk+-3.0
make build
gtk_ubuntu_20_04_build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-focal

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
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libgtk+-3.0 gtk+-3.0
make build
14 changes: 6 additions & 8 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Codecov

on:
Expand All @@ -9,21 +8,21 @@ on:
jobs:
codecov:
container:
image: swift:5.4-bionic
image: swiftlang/swift:nightly-focal
runs-on: ubuntu-latest
steps:
- run: apt-get update && apt-get install -y gtk+-3.0 libgtk+-3.0
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0
- name: Checkout Branch
uses: actions/checkout@v2
- name: Build Test Target
run: swift build --enable-test-discovery -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests
- name: Run Tests
run: swift test --enable-test-discovery --enable-code-coverage --skip-build
run: swift test --enable-code-coverage --skip-build
- name: Generate Branch Coverage Report
uses: mattpolzin/swift-codecov-action@0.6.1
uses: mattpolzin/swift-codecov-action@0.7.1
id: cov
with:
MINIMUM_COVERAGE: 20
MINIMUM_COVERAGE: 15
- name: Post Positive Results
if: ${{ success() }}
run: |
Expand All @@ -32,4 +31,3 @@ jobs:
if: ${{ failure() }}
run: |
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 }}%)."
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ Pods/
# SwiftPM
.build
/Packages

# VS Code
.vscode/launch.json
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wasm-5.6.0-RELEASE
17 changes: 0 additions & 17 deletions .vscode/launch.json

This file was deleted.

4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/swiftwasm/JavaScriptKit.git",
"state": {
"branch": null,
"revision": "6c31bad4b1ef18385262f5154845648c8c95ae94",
"version": "0.12.0"
"revision": "9a3b7d5f316e6d1709bd25e3e0392efca357f525",
"version": "0.14.0"
}
},
{
Expand Down
57 changes: 24 additions & 33 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
// swift-tools-version:5.4
// swift-tools-version:5.6

import PackageDescription

var tokamakDOMDependencies: [Target.Dependency] = [
"TokamakCore",
"TokamakStaticHTML",
.product(
name: "OpenCombineShim",
package: "OpenCombine"
),
.product(
name: "JavaScriptKit",
package: "JavaScriptKit",
condition: .when(platforms: [.wasi])
),
"OpenCombineJS",
]

#if compiler(>=5.5) && (canImport(Concurrency) || canImport(_Concurrency))
tokamakDOMDependencies.append(
.product(
name: "JavaScriptEventLoop",
package: "JavaScriptKit",
condition: .when(platforms: [.wasi])
)
)
#endif

let package = Package(
name: "Tokamak",
platforms: [
Expand Down Expand Up @@ -72,7 +47,7 @@ let package = Package(
dependencies: [
.package(
url: "https://github.com/swiftwasm/JavaScriptKit.git",
.upToNextMinor(from: "0.12.0")
.upToNextMinor(from: "0.14.0")
),
.package(
url: "https://github.com/OpenCombine/OpenCombine.git",
Expand All @@ -83,12 +58,10 @@ let package = Package(
.upToNextMinor(from: "0.1.2")
),
.package(
name: "Benchmark",
url: "https://github.com/google/swift-benchmark",
from: "0.1.0"
),
.package(
name: "SnapshotTesting",
url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
from: "1.9.0"
),
Expand Down Expand Up @@ -160,20 +133,38 @@ let package = Package(
.executableTarget(
name: "TokamakCoreBenchmark",
dependencies: [
"Benchmark",
.product(name: "Benchmark", package: "swift-benchmark"),
"TokamakCore",
]
),
.executableTarget(
name: "TokamakStaticHTMLBenchmark",
dependencies: [
"Benchmark",
.product(name: "Benchmark", package: "swift-benchmark"),
"TokamakStaticHTML",
]
),
.target(
name: "TokamakDOM",
dependencies: tokamakDOMDependencies
dependencies: [
"TokamakCore",
"TokamakStaticHTML",
.product(
name: "OpenCombineShim",
package: "OpenCombine"
),
.product(
name: "JavaScriptKit",
package: "JavaScriptKit",
condition: .when(platforms: [.wasi])
),
.product(
name: "JavaScriptEventLoop",
package: "JavaScriptKit",
condition: .when(platforms: [.wasi])
),
"OpenCombineJS",
]
),
.executableTarget(
name: "TokamakDemo",
Expand Down Expand Up @@ -213,7 +204,7 @@ let package = Package(
"TokamakStaticHTML",
.product(
name: "SnapshotTesting",
package: "SnapshotTesting",
package: "swift-snapshot-testing",
condition: .when(platforms: [.macOS])
),
],
Expand Down
Loading

0 comments on commit fd64eaf

Please sign in to comment.