Skip to content

Commit

Permalink
Update to Julia v1.9 (#15)
Browse files Browse the repository at this point in the history
* Update to Julia v1.9

* Version bump

* check 1.7 and windows

* remove unsupported platforms

* unique topic names

* Test sysimage generation

* Fix dev call

* Fix deps

* Fix sysimage test code

* Fix cert path

* always show resp

* remoev 1.7

* update julia compat to 1.9
  • Loading branch information
Octogonapus authored May 24, 2023
1 parent f68bb2c commit 79db7ad
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 14 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
tags: '*'
tags: ["*"]
pull_request:
concurrency:
# Skip intermediate builds: always.
Expand All @@ -18,18 +18,14 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7'
- "1.9"
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
Expand All @@ -46,14 +42,46 @@ jobs:
with:
file: ./lcov.info
fail_ci_if_error: false

test_sysimage:
name: test_sysimage ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "1.9"
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- run: |
julia --project -e 'import Pkg; Pkg.develop(path=".."); Pkg.instantiate(); Pkg.build();'
MQTT_ENABLED=false julia --project=sysimage -e 'import Pkg; Pkg.instantiate(); Pkg.build(); include(joinpath("sysimage", "build_sysimage.jl")); build()'
MQTT_ENABLED=true julia -J sysimage/sysimage.so -e 'Foo.start()'
working-directory: test_sysimage
env:
ENDPOINT: ${{ secrets.ENDPOINT }}
CERT_STRING: ${{ secrets.CERT_STRING }}
PRI_KEY_STRING: ${{ secrets.PRI_KEY_STRING }}
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
version: "1"
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/docs/build/
Manifest.toml
log.txt

.vscode/*

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AWSCRT"
uuid = "df31ea59-17a4-4ebd-9d69-4f45266dc2c7"
version = "0.1.1"
version = "0.1.2"

[deps]
AWSCRT_jll = "01db5350-6ea1-5d9a-9a47-8a31a394cb9c"
Expand All @@ -14,4 +14,4 @@ CEnum = "0.4"
CountDownLatches = "2"
ForeignCallbacks = "0.1"
LibAWSCRT = "0.1"
julia = "1.7"
julia = "1.9"
9 changes: 6 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ end

@testset "AWSCRT" begin
@testset "MQTT pub/sub integration test" begin
topic1 = "test-topic"
topic1 = "test-topic-$(Random.randstring(6))"
payload1 = Random.randstring(48)
client_id1 = Random.randstring(48)
client_id2 = Random.randstring(48)
@show topic1 payload1 client_id1 client_id2
tls_ctx_options = create_client_with_mtls(
ENV["CERT_STRING"],
ENV["PRI_KEY_STRING"],
Expand All @@ -42,7 +45,7 @@ end
connection,
ENV["ENDPOINT"],
8883,
Random.randstring(48);
client_id1;
will = Will(topic1, AWS_MQTT_QOS_AT_LEAST_ONCE, "The client has gone offline!", false),
on_connection_interrupted = (conn, error_code) -> begin
@warn "connection interrupted" error_code
Expand Down Expand Up @@ -108,7 +111,7 @@ end
connection,
ENV["ENDPOINT"],
8883,
"test-client-id2";
client_id2;
will = Will(topic1, AWS_MQTT_QOS_AT_LEAST_ONCE, "The client has gone offline!", false),
)
@test fetch(task) == Dict(:session_present => false)
Expand Down
2 changes: 2 additions & 0 deletions test_sysimage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest.toml
sysimage/sysimage.so
8 changes: 8 additions & 0 deletions test_sysimage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "Foo"
uuid = "97f99e65-a432-4aef-bc58-bf7726a8fb32"
version = "0.1.0"

[deps]
AWSCRT = "df31ea59-17a4-4ebd-9d69-4f45266dc2c7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
41 changes: 41 additions & 0 deletions test_sysimage/src/Foo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module Foo

using AWSCRT
using AWSCRT.LibAWSCRT
using Random
using Test

function start()
if ENV["MQTT_ENABLED"] == "true"
tls_ctx_options = create_client_with_mtls(
ENV["CERT_STRING"],
ENV["PRI_KEY_STRING"],
ca_filepath = joinpath(dirname(dirname(@__DIR__)), "test", "certs", "AmazonRootCA1.pem"),
)
tls_ctx = ClientTLSContext(tls_ctx_options)
client = MQTTClient(tls_ctx)
connection = MQTTConnection(client)
client_id = "unknown-client-id-$(Random.randstring(6))"
@show client_id
task = connect(
connection,
ENV["ENDPOINT"],
8883,
client_id;
on_connection_interrupted = (conn, error_code) -> begin
@warn "connection interrupted" error_code
end,
on_connection_resumed = (conn, return_code, session_present) -> begin
@info "connection resumed" return_code session_present
end,
)
resp = fetch(task)
@show resp
if resp != Dict(:session_present => false)
error("connect returned bad response: $resp")
end
end
return nothing
end

end
2 changes: 2 additions & 0 deletions test_sysimage/sysimage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
16 changes: 16 additions & 0 deletions test_sysimage/sysimage/build_sysimage.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using PackageCompiler

function build()
sysimage_path = joinpath(@__DIR__, "sysimage.so")
create_sysimage(
["Foo"];
project = dirname(@__DIR__),
sysimage_path,
# precompile_execution_file = joinpath(@__DIR__, "precompile.jl"),
precompile_statements_file = joinpath(@__DIR__, "precompile_list.jl"),
cpu_target = "generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)",
incremental = true,
include_transitive_dependencies = true,
)
return sysimage_path
end
2 changes: 2 additions & 0 deletions test_sysimage/sysimage/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
using Foo
Foo.start()
14 changes: 14 additions & 0 deletions test_sysimage/sysimage/precompile_list.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# this file contains all the precompiles generated by using precompile.jl

# these precompiles do not cause the segfault
precompile(Tuple{typeof(Base.:(!=)), UInt64, UInt64})
precompile(Tuple{typeof(Base.invokelatest), Any})
precompile(Tuple{Base.var"##s78#203", Any, Any, Any, Any, Any})
precompile(Tuple{typeof(Base.merge_types), Tuple{Vararg{Symbol}}, Type{var"#s78"} where var"#s78"<:(NamedTuple{names, T} where T<:Tuple where names), Type{var"#s77"} where var"#s77"<:(NamedTuple{names, T} where T<:Tuple where names)})
precompile(Tuple{Core.Compiler.var"#273#274", Any, Any})
precompile(Tuple{typeof(Base.uv_asynccb), Ptr{Nothing}})
precompile(Tuple{typeof(AWSCRT.__init__)})
precompile(Tuple{typeof(AWSCRT.on_connection_complete), Ptr{LibAWSCRT.aws_mqtt_client_connection}, Int32, Int32, UInt8, Ptr{Nothing}})

# including the below precompiles causes the segfault
precompile(Tuple{typeof(Foo.start)})

2 comments on commit 79db7ad

@Octogonapus
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/84165

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" 79db7adc8252caf9fbf2d43d487d3fb542be4cd0
git push origin v0.1.2

Please sign in to comment.