Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
76 changes: 76 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Swift

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
cancel_previous:
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
workflow_id: ${{ github.event.workflow.id }}

generate_code_coverage:
needs: cancel_previous
runs-on: macos-15
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.2"
- uses: actions/checkout@v2
- name: Build & Run tests
run: swift test --enable-code-coverage
- name: Convert coverage report
run: xcrun llvm-cov export -format="lcov" .build/debug/SubstrataPackageTests.xctest/Contents/MacOS/SubstrataPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: segmentio/substrata-swift

build_and_test_spm_mac:
needs: cancel_previous
runs-on: macos-15
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.2"
- uses: actions/checkout@v2
- name: Build & Run tests
run: swift test

build_and_test_ios:
needs: cancel_previous
runs-on: macos-15
steps:
- name: Install yeetd
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.2"
- uses: actions/checkout@v2
- run: xcodebuild -scheme Substrata-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16'
# disabled for tvOS -- unable to build right now.
#
#
# 'execve' is unavailable: not available on tvOS
# 'execve' is unavailable: not available on tvOS
# 'fork' is unavailable: not available on tvOS
# 'execve' is unavailable: not available on tvOS
#
# build_and_test_tvos:
# needs: cancel_previous
# runs-on: macos-15
# steps:
# - uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: "16.2"
# - uses: actions/checkout@v2
# - run: xcodebuild -scheme Substrata-Package test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV'
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
platforms: [
.macOS("10.15"),
.iOS("13.0"),
.tvOS("12.0")
.tvOS("12.0"),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
Expand All @@ -35,13 +35,13 @@ let package = Package(
]
),
.target(
name: "Substrata",
name: "Substrata",
dependencies: ["SubstrataQuickJS"]),
.testTarget(
name: "SubstrataTests",
dependencies: ["Substrata"],
resources: [
.copy("Support/ConversionTestData.js")
])
]),
]
)
2 changes: 0 additions & 2 deletions Sources/Substrata/Engine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class JSEngine {
}

deinit {
JS_RunGC(runtime)

context.shutdown()
JS_FreeRuntime(runtime)
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/SubstrataQuickJS/include/SubstrataQuickJS.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ static void js_decrement_refcount(JSValue v) {
...
}*/

// comment out in quickjs.c in JS_FreeRuntime
//assert(list_empty(&rt->gc_obj_list));

#endif // SEGMENT_H
2 changes: 1 addition & 1 deletion Sources/SubstrataQuickJS/quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ void JS_FreeRuntime(JSRuntime *rt)
}
#endif

assert(list_empty(&rt->gc_obj_list));
//assert(list_empty(&rt->gc_obj_list));

/* free the classes */
for(i = 0; i < rt->class_count; i++) {
Expand Down
2 changes: 2 additions & 0 deletions Sources/SubstrataQuickJS/quickjs_info.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
QuickJS-NG
https://github.com/quickjs-ng/quickjs
v0.8.0

See include/SubstrataQuickJS.h
23 changes: 23 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ignore:
- "Tests" # ignore all tests

coverage:
status:
project:
default:
target: 50%
threshold: 5%
informational: false
patch:
default:
target: 80%
informational: false

comment:
layout: "diff, flags, files"
behavior: default
require_changes: false # learn more in the Requiring Changes section below
require_base: false # [true :: must have a base report to post]
require_head: true # [true :: must have a head report to post]
hide_project_coverage: false # [true :: only show coverage on the git diff]