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

Prepare for release #1

Merged
merged 1 commit into from
Oct 21, 2024
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
20 changes: 7 additions & 13 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ on:
pull_request:

jobs:
build:
permissions:
contents: write
pull-requests: read
statuses: write
Documenter:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 'nightly'
- 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
version: '1'
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
run: julia --project=docs/ docs/make.jl
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
27 changes: 14 additions & 13 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,39 @@ on:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
julia-version:
- 'nightly'
os: [ ubuntu-latest, windows-latest ]
arch: [ x64 ]
julia-version: ['1', '1.11']
os: [ubuntu-latest, macOS-latest, windows-latest]
experimental: [false]
include:
# Include nightly, but experimental, so it's allowed to fail without
# failing CI.
- julia-version: nightly
julia-arch: x86
os: ubuntu-latest
experimental: true
# - julia-version: 1
# os: macOS-latest
# experimental: false
fail_ci_if_error: false

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Julia
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Run Tests
uses: julia-actions/julia-runtest@latest
- name: Create CodeCov
uses: julia-actions/julia-processcoverage@v1
uses: julia-actions/julia-processcoverage@latest
- name: Upload CodeCov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
file: ./lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

34 changes: 16 additions & 18 deletions src/PairwiseMappingFormat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,8 @@ function read_buffer!(reader::PAFReader)::Int
remaining = length(mem) - reader.filled
end
end

@assert !iszero(remaining)
# This part annoys me a lot. Julia has no efficient API to read bytes
# into a byte buffer. How on Earth can that be true?
# * read! will throw EOF if the memory is too short, and there is no
Expand All @@ -759,26 +761,22 @@ function read_buffer!(reader::PAFReader)::Int
# It uses bytesavailable to check how many bytes to read and avoid buffer overflows etc,
# and when there are zero bytes available, it reads a single byte, hoping that
# more bytes will be available.
if !iszero(remaining)
n_available = bytesavailable(reader.io)
n_available = bytesavailable(reader.io)
if iszero(n_available) && !eof(reader.io)
# Read one byte and hope more bytes become available
if iszero(n_available) && !eof(reader.io)
byte = read(reader.io, UInt8)
@inbounds mem[reader.filled + 1] = byte
reader.filled += 1
remaining -= 1
n_available = bytesavailable(reader.io)
end
# Read with unsafe_read
n_bytes = min(n_available, remaining)
if !iszero(n_bytes)
GC.@preserve mem unsafe_read(reader.io, pointer(mem, reader.filled + 1), n_bytes)
reader.filled += n_bytes
end
return n_bytes
else
return 0
byte = read(reader.io, UInt8)
@inbounds mem[reader.filled + 1] = byte
reader.filled += 1
remaining -= 1
n_available = bytesavailable(reader.io)
end
# Read with unsafe_read
n_bytes = min(n_available, remaining)
if !iszero(n_bytes)
GC.@preserve mem unsafe_read(reader.io, pointer(mem, reader.filled + 1), n_bytes)
reader.filled += n_bytes
end
return n_bytes
end

"""
Expand Down
Loading