Skip to content

Commit

Permalink
CI: Enabled running tests on pull requests (#68)
Browse files Browse the repository at this point in the history
* CI: Updated test workflow from PkgTemplates generated CI workflow

Also, added julia-cache and codecov-action actions.

* Fixed (TIFF) tests on Windows

* CI: Fixed Invalidations
  • Loading branch information
stemann authored Apr 26, 2024
1 parent deb2972 commit 583389c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 35 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI
on:
push:
branches:
- master
tags: ['*']
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
JULIA_NUM_THREADS: 2
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/InvalidationFlagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
steps:
- uses: julia-actions/setup-julia@v1
with:
version: 'nightly'
- uses: actions/checkout@v4.1.2
version: '1'
- uses: actions/checkout@v4
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-invalidations@v1
id: invs_pr

- uses: actions/checkout@v4.1.2
- uses: actions/checkout@v4
with:
ref: 'master'
- uses: julia-actions/julia-buildpkg@latest
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/test.yml

This file was deleted.

10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ Threads.nthreads() <= 1 && @info "Threads.nthreads() = $(Threads.nthreads()), mu
for typ in [Gray{N0f8}, Gray{Float64}, RGB{N0f8}, RGB{Float64}] # TODO: Add UInt8, N0f8 support in TiffImages
@testset "$typ TIFF" begin
img = rand(typ, 10, 10)
f = File{format"TIFF"}(joinpath(tmpdir, "test_fpath.tiff"))
f = File{format"TIFF"}(joinpath(tmpdir, "test_fpath_$(typ).tiff"))
ImageIO.save(f, img)
img_saveload = ImageIO.load(f)
@test img == img_saveload
@test typeof(img_saveload) == ImageIO.canonical_type(f, img_saveload)
img_saveload = ImageIO.load(f; mmap=true)
@test img == reshape(img_saveload, size(img))

open(io->ImageIO.save(Stream{format"TIFF"}(io), img), joinpath(tmpdir, "test_io.tiff"), "w")
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io)), joinpath(tmpdir, "test_io.tiff"))
open(io->ImageIO.save(Stream{format"TIFF"}(io), img), joinpath(tmpdir, "test_io_$(typ).tiff"), "w")
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io)), joinpath(tmpdir, "test_io_$(typ).tiff"))
@test img == img_saveload
@test typeof(img_saveload) == ImageIO.canonical_type(f, img_saveload)

Expand All @@ -141,9 +141,9 @@ Threads.nthreads() <= 1 && @info "Threads.nthreads() = $(Threads.nthreads()), mu
@test typeof(img_saveload) != ImageIO.canonical_type(f, img_saveload)
img_saveload = ImageIO.load(f; canonicalize=false)
@test typeof(img_saveload) != ImageIO.canonical_type(f, img_saveload)
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io); mmap=true), joinpath(tmpdir, "test_io.tiff"))
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io); mmap=true), joinpath(tmpdir, "test_io_$(typ).tiff"))
@test typeof(img_saveload) != ImageIO.canonical_type(f, img_saveload)
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io); canonicalize=false), joinpath(tmpdir, "test_io.tiff"))
img_saveload = open(io->ImageIO.load(Stream{format"TIFF"}(io); canonicalize=false), joinpath(tmpdir, "test_io_$(typ).tiff"))
@test typeof(img_saveload) != ImageIO.canonical_type(f, img_saveload)
end
end
Expand Down

0 comments on commit 583389c

Please sign in to comment.