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

Add depot caching to CI. Use scratchspace for test videos. Disable broken test video download #410

Merged
merged 11 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ on:

jobs:
test:
# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
julia-arch: [x64, x86]
julia-version: ['1.6','1','1.9-nightly','nightly']
julia-version: ['1.6','1','1.10-nightly','nightly']
exclude:
- os: macOS-latest
julia-arch: x86
Expand All @@ -25,6 +29,7 @@ jobs:
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ on:

jobs:
build:
# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
- uses: julia-actions/setup-julia@v1
with:
version: 1
- uses: julia-actions/cache@v1
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ deps/deps.jl
deps/deps_codec.jl
deps/build.log
.DS_Store
videos/*
Manifest.toml
deps/build_*
test/precisiontest_gray_test.mp4
test/ordertest_gray_test.mp4
docs/build/
Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"

[compat]
ColorTypes = "0.9, 0.10, 0.11"
Expand All @@ -25,4 +26,5 @@ ImageCore = "0.8, 0.9, 0.10"
PrecompileTools = "1"
ProgressMeter = "1.2"
Requires = "1.0"
Scratch = "1"
julia = "1.6"
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "1"
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ makedocs(
"Low Level Functionality"=>"lowlevel.md",
"Index"=>"functionindex.md",
],
warnonly = :missing_docs,
)
deploydocs(repo = "github.com/JuliaIO/VideoIO.jl.git", push_preview = true)
2 changes: 1 addition & 1 deletion docs/src/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ VideoIO.open_video_out
```

```@docs
VideoIO.write
Base.write(writer::VideoIO.VideoWriter, img, index::Int)
```

```@docs
Expand Down
2 changes: 1 addition & 1 deletion src/encoding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ key of `VideoIO.VIO_DEF_ELTYPE_PIX_FMT_LU`, or instead the `Normed` or
`Unsigned` type for a corresponding `Gray` element type. The container type will
be inferred from `filename`.

Frames are encoded with[ `write`](@ref), which must use frames with
Frames are encoded with [`write`](@ref), which must use frames with
the same size, element type, and obey the same value of `scanline_major`. The
video must be closed once all frames are encoded with
[`close_video_out!`](@ref).
Expand Down
45 changes: 30 additions & 15 deletions src/testvideos.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Tools for downloading test videos
"""
VideoIO.TestVideos

Tools for downloading test videos

* `VideoIO.TestVideos.available()` prints a list of all available test videos.
* `VideoIO.testvideo("annie_oakley")` returns an AVInput object for the
"annie_oakley" video. The video will be downloaded if it isn't available.
* `VideoIO.TestVideos.download_all()` downloads all test videos
* `VideoIO.TestVideos.remove_all()` removes all test videos
"""
module TestVideos

using VideoIO: VideoIO
import Base: show
import Downloads: download
using Scratch
export testvideo

videodir = joinpath(dirname(@__FILE__), "..", "videos")
videodir = ""

function __init__()
global videodir = @get_scratch!("videos")
end

mutable struct VideoFile{compression}
name::AbstractString
Expand Down Expand Up @@ -117,19 +131,20 @@ const videofiles = Dict(
1,
4816,
),
"Big_Buck_Bunny_360_10s_1MB.mp4" => VideoFile(
"Big_Buck_Bunny_360_10s_1MB.mp4",
"Big Buck Bunny",
"Creative Commons: By Attribution 3.0 Unported (http://creativecommons.org/licenses/by/3.0/deed)",
"Credit: Blender Foundation | www.blender.org",
"https://peach.blender.org/",
"https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
300,
2,
207376840,
# Can be also 30000/1001
30 // 1,
),
# # This has started HTTP 526 erroring
# "Big_Buck_Bunny_360_10s_1MB.mp4" => VideoFile(
# "Big_Buck_Bunny_360_10s_1MB.mp4",
# "Big Buck Bunny",
# "Creative Commons: By Attribution 3.0 Unported (http://creativecommons.org/licenses/by/3.0/deed)",
# "Credit: Blender Foundation | www.blender.org",
# "https://peach.blender.org/",
# "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4",
# 300,
# 2,
# 207376840,
# # Can be also 30000/1001
# 30 // 1,
# ),
)

"""
Expand Down
8 changes: 4 additions & 4 deletions test/reading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name = testvid.name
test_frameno = testvid.testframe
@testset "Reading $(testvid.name)" begin
testvid_path = joinpath(@__DIR__, "../videos", name)
testvid_path = joinpath(VideoIO.TestVideos.videodir, name)
comparison_frame = make_comparison_frame_png(load, testvid_path, test_frameno)
f = VideoIO.testvideo(testvid_path)
v = VideoIO.openvideo(f; swscale_options=swscale_options)
Expand Down Expand Up @@ -157,7 +157,7 @@ end
@memory_profile

@testset "Reading monochrome videos" begin
testvid_path = joinpath(@__DIR__, "../videos", "annie_oakley.ogg")
testvid_path = joinpath(VideoIO.TestVideos.videodir, "annie_oakley.ogg")
# Test that limited range YCbCr values are translated to "full range"
minp, maxp = VideoIO.openvideo(get_video_extrema, testvid_path, target_format=VideoIO.AV_PIX_FMT_GRAY8)
@test typeof(minp) == Gray{N0f8}
Expand Down Expand Up @@ -188,7 +188,7 @@ end
end
end
@testset "Full load" begin
testvid_path = joinpath(@__DIR__, "../videos", "ladybird.mp4")
testvid_path = joinpath(VideoIO.TestVideos.videodir, "ladybird.mp4")
vid = VideoIO.load(testvid_path, target_format=VideoIO.AV_PIX_FMT_GRAY8)
@test eltype(first(vid)) == Gray{N0f8}
end
Expand All @@ -204,7 +204,7 @@ end
# TODO: fix me?
(startswith(name, "ladybird") || startswith(name, "NPS")) && continue
@testset "Testing $name" begin
testvid_path = joinpath(@__DIR__, "../videos", name)
testvid_path = joinpath(VideoIO.TestVideos.videodir, name)
comparison_frame = make_comparison_frame_png(load, testvid_path, test_frameno)
filename = joinpath(videodir, name)
VideoIO.openvideo(filename; swscale_options=swscale_options) do v
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using FFMPEG: FFMPEG
using VideoIO: VideoIO

const testdir = dirname(@__FILE__)
const videodir = joinpath(testdir, "..", "videos")
const videodir = VideoIO.TestVideos.videodir
const tempvidname = "testvideo.mp4"
const tempvidpath = joinpath(tempdir(), tempvidname)
const required_accuracy = 0.07
Expand Down
7 changes: 0 additions & 7 deletions videos/README-videos.md

This file was deleted.

Loading