Skip to content

Commit 9640db8

Browse files
[release-0.1] Fix concurrency issue. Require Julia v1.6 and update CI setup. (#14)
* fix concurrency issue * patch bump * Require Julia v1.6 and update CI setup (cherry picked from commit fd7d08f) * update CI to run on release branches * exclude macos on min because of no-arm * update to Threads.Condition * don't use `@lock` as it's not on julia 1.6 * use `Base.@lock` * update Documenter setup for v0.1 & v1 to coexist --------- Co-authored-by: Mosè Giordano <[email protected]>
1 parent 433285f commit 9640db8

File tree

5 files changed

+40
-20
lines changed

5 files changed

+40
-20
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,58 @@ name: CI
22

33
on:
44
push:
5-
branches: "master"
5+
branches:
6+
- "master"
7+
- "release-*"
68
tags: ["*"]
79
pull_request:
810
release:
911

1012
jobs:
1113
test:
12-
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }} - ${{ matrix.julia-arch }}
14+
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }}
1315
runs-on: ${{ matrix.os }}
16+
env:
17+
JULIA_NUM_THREADS: auto
1418
strategy:
1519
fail-fast: false
1620
matrix:
1721
julia-version:
18-
- "1.0"
22+
- "min"
1923
- "1"
2024
- "nightly"
2125
os:
2226
- ubuntu-latest
2327
- macos-latest
2428
julia-arch:
25-
- x64
29+
- default
30+
exclude:
31+
- julia-version: "min"
32+
os: macos-latest
2633
steps:
27-
- uses: actions/checkout@v3
28-
- uses: julia-actions/setup-julia@v1
34+
- uses: actions/checkout@v6
35+
- uses: julia-actions/setup-julia@v2
2936
with:
3037
version: ${{ matrix.julia-version }}
3138
arch: ${{ matrix.julia-arch }}
32-
- uses: julia-actions/cache@v1
39+
- uses: julia-actions/cache@v2
3340
- uses: julia-actions/julia-buildpkg@v1
3441
- uses: julia-actions/julia-runtest@v1
3542
- uses: julia-actions/julia-processcoverage@v1
36-
- uses: codecov/codecov-action@v3
43+
- uses: codecov/codecov-action@v5
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
files: lcov.info
47+
continue-on-error: true
3748

3849
Documentation:
3950
runs-on: ubuntu-latest
4051
steps:
41-
- uses: actions/checkout@v3
42-
- uses: julia-actions/setup-julia@latest
52+
- uses: actions/checkout@v6
53+
- uses: julia-actions/setup-julia@v2
4354
with:
4455
version: 1
45-
- uses: julia-actions/cache@v1
56+
- uses: julia-actions/cache@v2
4657
with:
4758
cache-registries: "true"
4859
- uses: julia-actions/julia-docdeploy@v1

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name = "OutputCollectors"
22
uuid = "6c11c7d4-943b-4e2b-80de-f2cfc2930a8c"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[compat]
7-
julia = "1"
7+
julia = "1.6"
88

99
[extras]
1010
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

docs/make.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ makedocs(
88
deploydocs(
99
repo = "github.com/JuliaPackaging/OutputCollectors.jl.git",
1010
push_preview = true,
11+
devbranch = "master",
12+
versions = ["v0.1" => "release-0.1", "v1" => "master", "v#.#"],
1113
)

src/OutputCollectors.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Given a `Pipe` that has been initialized by `spawn()`, create an async Task to
5050
read in lines as they come in and annotate the time the line was captured for
5151
later replay/merging with other simultaneously captured streams.
5252
"""
53-
function LineStream(pipe::Pipe, event::Condition)
53+
function LineStream(pipe::Pipe, event::Threads.Condition)
5454
# We always have to close() the input half of the stream before we can
5555
# read() from it. I don't know why, and this is honestly kind of annoying
5656
close(pipe.in)
@@ -65,7 +65,7 @@ function LineStream(pipe::Pipe, event::Condition)
6565
break
6666
end
6767
push!(lines, (time(), line))
68-
notify(event)
68+
Base.@lock event notify(event)
6969
end
7070
end
7171

@@ -74,7 +74,7 @@ function LineStream(pipe::Pipe, event::Condition)
7474
# being alive (e.g. `tee()`) can die alongside us gracefully as well.
7575
@async begin
7676
fetch(task)
77-
notify(event)
77+
Base.@lock event notify(event)
7878
end
7979
return LineStream(pipe, lines, task)
8080
end
@@ -101,7 +101,7 @@ mutable struct OutputCollector
101101
P::Base.AbstractPipe
102102
stdout_linestream::LineStream
103103
stderr_linestream::LineStream
104-
event::Condition
104+
event::Threads.Condition
105105
tee_stream::IO
106106
verbose::Bool
107107
tail_error::Bool
@@ -136,7 +136,7 @@ function OutputCollector(cmd::Base.AbstractCmd; verbose::Bool=false,
136136
end
137137

138138
# Next, start siphoning off the first couple lines of output and error
139-
event = Condition()
139+
event = Threads.Condition()
140140
out_ls = LineStream(out_pipe, event)
141141
err_ls = LineStream(err_pipe, event)
142142

@@ -345,15 +345,15 @@ function tee(c::OutputCollector; colored::Bool=get_have_color(),
345345

346346
# First thing, wait for some input. This avoids us trying to inspect
347347
# the liveliness of the linestreams before they've even started.
348-
wait(c.event)
348+
Base.@lock c.event wait(c.event)
349349

350350
while alive(c.stdout_linestream) || alive(c.stderr_linestream)
351351
if length(out_lines) >= out_idx || length(err_lines) >= err_idx
352352
# If we have data to output, then do so
353353
print_next_line()
354354
else
355355
# Otherwise, wait for more input
356-
wait(c.event)
356+
Base.@lock c.event wait(c.event)
357357
end
358358
end
359359

0 commit comments

Comments
 (0)