Skip to content

Commit c96eb16

Browse files
authored
add ci (#1)
* add ci * fix ci * fix macos and windows ci
1 parent 4388803 commit c96eb16

File tree

6 files changed

+91
-26
lines changed

6 files changed

+91
-26
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
tags: ["*"]
6+
pull_request:
7+
jobs:
8+
test:
9+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
version:
15+
- '1.6'
16+
- '1' # automatically expands to the latest stable 1.x release of Julia
17+
- nightly
18+
os:
19+
- ubuntu-latest
20+
arch:
21+
- x64
22+
- x86
23+
include:
24+
# test macOS and Windows with latest Julia only
25+
- os: macOS-latest
26+
arch: x64
27+
version: 1
28+
- os: windows-latest
29+
arch: x64
30+
version: 1
31+
- os: windows-latest
32+
arch: x86
33+
version: 1
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: julia-actions/setup-julia@v1
37+
with:
38+
version: ${{ matrix.version }}
39+
arch: ${{ matrix.arch }}
40+
- uses: actions/cache@v1
41+
env:
42+
cache-name: cache-artifacts
43+
with:
44+
path: ~/.julia/artifacts
45+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
46+
restore-keys: |
47+
${{ runner.os }}-test-${{ env.cache-name }}-
48+
${{ runner.os }}-test-
49+
${{ runner.os }}-
50+
- uses: julia-actions/julia-buildpkg@v1
51+
- uses: julia-actions/julia-runtest@v1
52+
- uses: julia-actions/julia-processcoverage@v1
53+
- uses: codecov/codecov-action@v1
54+
with:
55+
file: lcov.info

test/client/petstore_v2/petstore_test_petapi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function test(uri)
3030
# @test updatePetWithForm(api, 10; in_name="meow") === nothing
3131

3232
@info("PetApi - get_pet_by_id")
33-
pet10 = get_pet_by_id(api, 10)
33+
pet10 = get_pet_by_id(api, Int64(10))
3434
@test pet10.id == 10
3535

3636
@info("PetApi - find_pets_by_status")
@@ -43,7 +43,7 @@ function test(uri)
4343
end
4444

4545
@info("PetApi - deletePet")
46-
@test delete_pet(api, 10) === nothing
46+
@test delete_pet(api, Int64(10)) === nothing
4747

4848
# does not work yet. issue: https://github.com/JuliaWeb/Requests.jl/issues/139
4949
#@info("PetApi - upload_file")

test/client/petstore_v2/petstore_test_storeapi.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ function test(uri)
2525
@test neworder.id == 5
2626

2727
@info("StoreApi - get_order_by_id")
28-
@test_throws OpenAPI.ValidationException get_order_by_id(api, 0)
29-
order = get_order_by_id(api, 5)
28+
@test_throws OpenAPI.ValidationException get_order_by_id(api, Int64(0))
29+
order = get_order_by_id(api, Int64(5))
3030
@test isa(order, Order)
3131
@test order.id == 5
3232
@test isa(order.shipDate, ZonedDateTime)
3333

3434
@info("StoreApi - get_order_by_id (async)")
3535
response_channel = Channel{Order}(1)
36-
@test_throws OpenAPI.ValidationException get_order_by_id(api, response_channel, 0)
36+
@test_throws OpenAPI.ValidationException get_order_by_id(api, response_channel, Int64(0))
3737
@sync begin
3838
@async begin
39-
resp = get_order_by_id(api, response_channel, 5)
39+
resp = get_order_by_id(api, response_channel, Int64(5))
4040
@test (200 <= resp.status <= 206)
4141
end
4242
@async begin
@@ -49,11 +49,11 @@ function test(uri)
4949
# a closed channel is equivalent of cancellation of the call,
5050
# no error should be thrown, but response can be nothing if call was interrupted immediately
5151
@test !isopen(response_channel)
52-
resp = get_order_by_id(api, response_channel, 5)
52+
resp = get_order_by_id(api, response_channel, Int64(5))
5353
@test (resp === nothing) || (200 <= resp.status <= 206)
5454

5555
@info("StoreApi - delete_order")
56-
@test delete_order(api, 5) === nothing
56+
@test delete_order(api, Int64(5)) === nothing
5757

5858
nothing
5959
end

test/client/petstore_v3/petstore_test_petapi.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function test(uri)
3030
# @test update_pet_with_form(api, 10; in_name="meow") === nothing
3131

3232
@info("PetApi - get_pet_by_id")
33-
pet10 = get_pet_by_id(api, 10)
33+
pet10 = get_pet_by_id(api, Int64(10))
3434
@test pet10.id == 10
3535

3636
@info("PetApi - find_pets_by_status")
@@ -43,7 +43,7 @@ function test(uri)
4343
end
4444

4545
@info("PetApi - delete_pet")
46-
@test delete_pet(api, 10) === nothing
46+
@test delete_pet(api, Int64(10)) === nothing
4747

4848
# does not work yet. issue: https://github.com/JuliaWeb/Requests.jl/issues/139
4949
#@info("PetApi - upload_file")

test/client/petstore_v3/petstore_test_storeapi.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ function test(uri)
2525
@test neworder.id == 5
2626

2727
@info("StoreApi - get_order_by_id")
28-
@test_throws OpenAPI.ValidationException get_order_by_id(api, 0)
29-
order = get_order_by_id(api, 5)
28+
@test_throws OpenAPI.ValidationException get_order_by_id(api, Int64(0))
29+
order = get_order_by_id(api, Int64(5))
3030
@test isa(order, Order)
3131
@test order.id == 5
3232
@test isa(order.shipDate, ZonedDateTime)
3333

3434
@info("StoreApi - get_order_by_id (async)")
3535
response_channel = Channel{Order}(1)
36-
@test_throws OpenAPI.ValidationException get_order_by_id(api, response_channel, 0)
36+
@test_throws OpenAPI.ValidationException get_order_by_id(api, response_channel, Int64(0))
3737
@sync begin
3838
@async begin
39-
resp = get_order_by_id(api, response_channel, 5)
39+
resp = get_order_by_id(api, response_channel, Int64(5))
4040
@test (200 <= resp.status <= 206)
4141
end
4242
@async begin
@@ -49,7 +49,7 @@ function test(uri)
4949
# a closed channel is equivalent of cancellation of the call,
5050
# no error should be thrown, but response can be nothing if call was interrupted immediately
5151
@test !isopen(response_channel)
52-
resp = get_order_by_id(api, response_channel, 5)
52+
resp = get_order_by_id(api, response_channel, Int64(5))
5353
@test (resp === nothing) || (200 <= resp.status <= 206)
5454

5555
@info("StoreApi - delete_order")

test/runtests.jl

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,35 @@ include("client/runtests.jl")
55
@testset "OpenAPI" begin
66
@testset "Client" begin
77
try
8-
run(`client/petstore_v2/start_petstore_server.sh`)
9-
run(`client/petstore_v3/start_petstore_server.sh`)
10-
sleep(20)
8+
if get(ENV, "RUNNER_OS", "") == "Linux"
9+
run(`client/petstore_v2/start_petstore_server.sh`)
10+
run(`client/petstore_v3/start_petstore_server.sh`)
11+
sleep(20)
12+
end
1113
OpenAPIClientTests.runtests()
1214
finally
13-
run(`client/petstore_v2/stop_petstore_server.sh`)
14-
run(`client/petstore_v3/stop_petstore_server.sh`)
15+
if get(ENV, "RUNNER_OS", "") == "Linux"
16+
run(`client/petstore_v2/stop_petstore_server.sh`)
17+
run(`client/petstore_v3/stop_petstore_server.sh`)
18+
end
1519
end
1620
end
17-
sleep(20)
21+
if get(ENV, "RUNNER_OS", "") == "Linux"
22+
sleep(20)
23+
end
1824
@testset "Server" begin
1925
try
20-
run(`server/petstore_v2/start_petstore_server.sh`)
21-
run(`server/petstore_v3/start_petstore_server.sh`)
22-
sleep(20)
26+
if get(ENV, "RUNNER_OS", "") == "Linux"
27+
run(`server/petstore_v2/start_petstore_server.sh`)
28+
run(`server/petstore_v3/start_petstore_server.sh`)
29+
sleep(20)
30+
end
2331
OpenAPIClientTests.runtests()
2432
finally
25-
run(`server/petstore_v2/stop_petstore_server.sh`)
26-
run(`server/petstore_v3/stop_petstore_server.sh`)
33+
if get(ENV, "RUNNER_OS", "") == "Linux"
34+
run(`server/petstore_v2/stop_petstore_server.sh`)
35+
run(`server/petstore_v3/stop_petstore_server.sh`)
36+
end
2737
end
2838
end
2939
end

0 commit comments

Comments
 (0)