Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and test with SwiftWasm 5.6 on CI #475

Merged
merged 25 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7c85175
Build and test with SwiftWasm 5.6 on CI
MaxDesiatov Apr 5, 2022
e7b44b4
Create .swift-version
MaxDesiatov Apr 5, 2022
ef4eb7b
Specify `main` version for 5.6 jobs
MaxDesiatov Apr 5, 2022
006ddbc
Fix build issue with SwiftWasm 5.6
MaxDesiatov Apr 5, 2022
e5dd8fe
Update JavaScriptKit to 0.13.0
kateinoigakukun Apr 6, 2022
991c603
Update to latest JSKit, drop SwiftWasm 5.4/5.5
MaxDesiatov Apr 8, 2022
3f00371
Temporarily disable `macos-11` builds
MaxDesiatov Apr 8, 2022
4b78644
Try to avoid 5.6 crash on Linux
MaxDesiatov Apr 8, 2022
b6175c1
Disable broken CI jobs
MaxDesiatov Apr 8, 2022
11ab7d5
Try to use Swift 5.6 in `codecov.yml`
MaxDesiatov Apr 8, 2022
ec0a9d7
Disable `codecov.yml` job for now
MaxDesiatov Apr 8, 2022
643ad2b
Fully disable `codecov.yml`
MaxDesiatov Apr 8, 2022
01d4ed1
Clean up `launch.json`
MaxDesiatov Apr 8, 2022
a265920
Clarify requirements in `README.md`
MaxDesiatov Apr 8, 2022
3414858
Try nightly-5.6 image in `codecov.yml`
MaxDesiatov Apr 8, 2022
b4bf6b5
Try `nightly-5.6-focal` in `codecov.yml`
MaxDesiatov Apr 8, 2022
128c3dc
Add `DEBIAN_FRONTEND=noninteractive` in `codecov.yml`
MaxDesiatov Apr 8, 2022
bbe9820
Try `nightly-focal` image in `codecov.yml`
MaxDesiatov Apr 8, 2022
002c41f
Use nightly Swift for GTK Linux builds
MaxDesiatov Apr 8, 2022
812b44f
Avoid using `sudo` when building in a Docker container
MaxDesiatov Apr 8, 2022
cc76eb8
Add `build-essential` for Ubuntu Docker jobs
MaxDesiatov Apr 8, 2022
0d3af14
Use `[email protected]` in `codecov.yml`
MaxDesiatov Apr 8, 2022
e6a0ede
Update codecov.yml
MaxDesiatov Apr 8, 2022
42d1a21
Remove unused compiler version checks
MaxDesiatov Apr 8, 2022
498b286
Update .github/workflows/codecov.yml
MaxDesiatov Apr 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 7 additions & 8 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# Disable until crashes with Swift 5.6 are fixed.
j-f1 marked this conversation as resolved.
Show resolved Hide resolved
MaxDesiatov marked this conversation as resolved.
Show resolved Hide resolved
name: Codecov

on:
Expand All @@ -9,21 +9,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 +32,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to update tools version? Can we keep [email protected] for older toolchains?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me double-check this once again... I've tried this once and 5.4/5.5 didn't really work with latest carton

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, latest carton doesn't support SwiftWasm 5.5 with this package:

/Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift build -c debug --product TokamakDemo --triple wasm32-unknown-wasi -Xlinker -licuuc -Xlinker -licui18n -Xlinker /Users/maxd/.carton/static/so_sanitizer.wasm -Xlinker --stack-first
Fetching https://github.com/pointfreeco/swift-snapshot-testing.git from cache
Fetching https://github.com/swiftwasm/JavaScriptKit.git from cache
Fetching https://github.com/swiftwasm/OpenCombineJS.git from cache
Fetched https://github.com/swiftwasm/OpenCombineJS.git (0.57s)
Fetching https://github.com/apple/swift-argument-parser from cache
Fetched https://github.com/swiftwasm/JavaScriptKit.git (0.61s)
Fetching https://github.com/OpenCombine/OpenCombine.git from cache
Fetched https://github.com/pointfreeco/swift-snapshot-testing.git (0.62s)
Fetching https://github.com/google/swift-benchmark from cache
Fetched https://github.com/google/swift-benchmark (0.53s)
Fetched https://github.com/apple/swift-argument-parser (0.64s)
Fetched https://github.com/OpenCombine/OpenCombine.git (0.80s)
Computing version for https://github.com/pointfreeco/swift-snapshot-testing.git

Process failed and produced following output: 
Process failed with non-zero exit status and following output:
 and following error output:
https://github.com/pointfreeco/swift-snapshot-testing.git @ 1.9.0: error: invalidManifestFormat("Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.\nStack dump:\n0.\tProgram arguments: /Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv.swift -target arm64-apple-macosx11.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -I /Users/maxd/Library/Developer/Toolchains/swift-wasm-5.5.0-RELEASE.xctoolchain/usr/lib/swift/pm/ManifestAPI -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -swift-version 5 -package-description-version 5.0.0 -disable-implicit-concurrency-module-import -target-sdk-version 12.3 -module-name main -o /var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv-03e596.o\n1.\tSwiftWasm Swift version 5.5 (swiftlang-5.5.0)\n2.\t\n3.\tWhile evaluating request IRGenRequest(IR Generation for file \"/var/folders/0k/y5p_js3n0px8m267zq95dkd40000gn/T/TemporaryFile.Ntq1Bv.swift\")\n4.\tWhile emitting IR SIL function \"@main\".\nStack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):\n0  swift-frontend           0x0000000103f493e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56\n1  swift-frontend           0x0000000103f48520 llvm::sys::RunSignalHandlers() + 128\n2  swift-frontend           0x0000000103f49c1c SignalHandler(int) + 292\n3  libsystem_platform.dylib 0x00000001ab2ed4c4 _sigtramp + 56\n4  swift-frontend           0x0000000101fbdc60 clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>, bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>, clang::CodeGen::RequiredArgs) + 792\n5  swift-frontend           0x0000000101fbdc60 clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>, bool, bool, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, llvm::ArrayRef<clang::FunctionType::ExtParameterInfo>, clang::CodeGen::RequiredArgs) + 792\n6  swift-frontend           0x0000000102151d28 clang::CodeGen::arrangeFreeFunctionCall(clang::CodeGen::CodeGenModule&, clang::CanQual<clang::Type>, llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo, clang::CodeGen::RequiredArgs) + 60\n7  swift-frontend           0x0000000100bccdd8 swift::irgen::Signature::getUncached(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 968\n8  swift-frontend           0x0000000100c4ac9c swift::irgen::IRGenModule::getSignature(swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 172\n9  swift-frontend           0x0000000100c7da9c swift::irgen::getObjCMethodCallee(swift::irgen::IRGenFunction&, swift::irgen::ObjCMethod const&, llvm::Value*, swift::irgen::CalleeInfo&&) + 120\n10 swift-frontend           0x0000000100d0acd4 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2772\n11 swift-frontend           0x0000000100cf4e28 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 6528\n12 swift-frontend           0x0000000100c043c0 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 716\n13 swift-frontend           0x0000000100cc90cc swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 1784\n14 swift-frontend           0x0000000100cf31d0 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 188\n15 swift-frontend           0x0000000100cd2954 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 332\n16 swift-frontend           0x0000000100ccaf2c swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 196\n17 swift-frontend           0x0000000100967ae4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1904\n18 swift-frontend           0x00000001009670e0 performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 300\n19 swift-frontend           0x000000010095d428 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4076\n20 swift-frontend           0x00000001008c986c main + 544\n21 dyld                     0x00000001061d9088 start + 516\n<unknown>:0: error: unable to execute command: Segmentation fault: 11\n<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)", diagnosticFile: nil) in https://github.com/pointfreeco/swift-snapshot-testing.git


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