Skip to content

Commit

Permalink
Better progress reporting
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Deorowicz <sebastian.deorowicz@polsl.pl>
  • Loading branch information
agudys and sebastiandeorowicz authored Nov 25, 2024
1 parent e3cc571 commit c898e1e
Show file tree
Hide file tree
Showing 16 changed files with 1,195 additions and 214 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
runs-on: [self-hosted, lz-ani, '${{ matrix.machine }}']

steps:
- name: clean
run: rm -rf ${{ github.workspace }}/*
- uses: actions/checkout@v4
with:
submodules: recursive
Expand Down Expand Up @@ -47,10 +49,9 @@ jobs:
steps:
- name: make
run: |
make clean
make -j32 CXX=${{matrix.compiler}} STATIC_LINK=true PLATFORM=${{ matrix.platform }}
gmake -j32 CXX=${{matrix.compiler}} STATIC_LINK=true PLATFORM=${{ matrix.platform }}
- name: tar artifacts
run: tar -cvzf lz-ani.tar.gz lz-ani LICENSE
run: tar -cvzf lz-ani.tar.gz LICENSE -C ./bin lz-ani


########################################################################################
Expand All @@ -65,7 +66,7 @@ jobs:

steps:
- name: help
run: ./lz-ani
run: ./bin/lz-ani

########################################################################################
upload:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Actions CI
name: Build and tests

on:
push:
Expand All @@ -15,20 +15,25 @@ jobs:
strategy:
fail-fast: false
matrix:
machine: [ubuntu-latest, macOS-12]
machine: [ubuntu-latest]
gmake_install_command: ['gmake --version']
include:
- {machine: macOS-13, gmake_install_command: 'brew install make && gmake --version'}
runs-on: ['${{ matrix.machine }}']

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: install gmake
run: ${{ matrix.gmake_install_command }}
- name: make
run: |
g++ --version
make -j CXX=g++-12
gmake -j CXX=g++-12 CC=gcc-12 STATIC_LINK=true
- name: tar artifacts
run: tar -cvf lz-ani.tar ./lz-ani ./test
run: tar -cvf lz-ani.tar ./test -C ./bin lz-ani

- uses: actions/upload-artifact@v4
with:
Expand All @@ -42,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
machine: [ubuntu-latest, macOS-12]
machine: [ubuntu-latest, macOS-13]
runs-on: ['${{ matrix.machine }}']

steps:
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
runs-on: [self-hosted, lz-ani, '${{ matrix.machine }}']

steps:
- name: clean
run: rm -rf ${{ github.workspace }}/*
- uses: actions/checkout@v4
with:
submodules: recursive
Expand All @@ -31,28 +33,24 @@ jobs:
fail-fast: false
matrix:
machine: [x64_linux, x64_mac, arm64_linux, arm64_mac]
compiler: [g++-11, g++-12, g++-13]
compiler: [11, 12, 13]
include:
- machine: x64_linux
platform: avx2
- machine: arm64_linux
platform: arm8
- machine: x64_mac
platform: avx2
- machine: arm64_mac
platform: m1
- {machine: x64_linux, platform: avx2, compiler: 14}
- {machine: x64_linux, platform: avx2}
- {machine: arm64_linux, platform: arm8}
- {machine: x64_mac, platform: avx2}
- {machine: arm64_mac, platform: m1}
exclude:
- machine: arm64_linux
compiler: g++-13
- {machine: arm64_linux, compiler: 13}

runs-on: [self-hosted, lz-ani, '${{ matrix.machine }}']

steps:
- name: make
run: |
make -j32 CXX=${{matrix.compiler}} PLATFORM=${{ matrix.platform }}
cp ./lz-ani ./lz-ani-${{matrix.compiler}}
make clean
gmake -j32 CXX=g++-${{matrix.compiler}} CC=gcc-${{matrix.compiler}} PLATFORM=${{ matrix.platform }} STATIC_LINK=true
cp ./bin/lz-ani ./lz-ani-${{matrix.compiler}}
gmake clean
########################################################################################
help:
Expand All @@ -62,10 +60,11 @@ jobs:
fail-fast: false
matrix:
machine: [x64_linux, x64_mac, arm64_linux, arm64_mac]
compiler: [g++-11, g++-12, g++-13]
compiler: [11, 12, 13]
include:
- {machine: x64_linux, platform: avx2, compiler: 14}
exclude:
- machine: arm64_linux
compiler: g++-13
- {machine: arm64_linux, compiler: 13}

runs-on: [self-hosted, lz-ani, '${{ matrix.machine }}']

Expand All @@ -74,9 +73,9 @@ jobs:

steps:
- name: help
run: |
${EXEC}
run: ${EXEC}
- name: version
run: ${EXEC} -version

########################################################################################
vir61:
Expand All @@ -86,10 +85,11 @@ jobs:
fail-fast: false
matrix:
machine: [x64_linux, x64_mac, arm64_linux, arm64_mac]
compiler: [g++-11, g++-12, g++-13]
compiler: [11, 12, 13]
include:
- {machine: x64_linux, platform: avx2, compiler: 14}
exclude:
- machine: arm64_linux
compiler: g++-13
- {machine: arm64_linux, compiler: 13}

runs-on: [self-hosted, lz-ani, '${{ matrix.machine }}']

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![GitHub downloads](https://img.shields.io/github/downloads/refresh-bio/lz-ani/total.svg?style=flag&label=GitHub%20downloads)](https://github.com/refresh-bio/LZ-ANI/releases)
[![Bioconda downloads](https://img.shields.io/conda/dn/bioconda/lz-ani.svg?style=flag&label=Bioconda%20downloads)](https://anaconda.org/bioconda/lz-ani)
[![GitHub Actions CI](../../workflows/GitHub%20Actions%20CI/badge.svg)](../../actions/workflows/main.yml)
[![Build and tests](../../workflows/Build%20and%20tests/badge.svg)](../../actions/workflows/main.yml)

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

Expand Down
55 changes: 28 additions & 27 deletions libs/refresh/compression/lib/file_wrapper.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
// *******************************************************************************************
// This file is a part of LZ-ANI software distributed under GNU GPL 3 license.
// The homepage of the LZ-ANI project is https://github.com/refresh-bio/LZ-ANI
//
// Copyright(C) 2024-2024, S.Deorowicz, A.Gudys
//
// Version: 1.0.0
// Date : 2024-05-15
// *******************************************************************************************

#ifndef _FILE_WRAPPER_H
#define _FILE_WRAPPER_H

// *** History of updates
// *** v. 1.0.1 (2024-03-11) - bug fix (wrong zlib initialization)
// *** v. 1.0.2 (2024-05-01) - bug fix (wrong reading from file)
// ***

#include <cstdint>
#include <cstring>
#include <cstdio>
Expand Down Expand Up @@ -46,9 +41,9 @@

#ifdef REFRESH_STREAM_DECOMPRESSION_ENABLE_ZLIB
#ifdef _WIN32
#include "../libs/zlib-ng/build-vs/zlib.h"
#include <zlib-ng/build-vs/zlib.h>
#else
#include "../zlib-ng/zlib.h"
#include <zlib-ng/zlib.h>
#endif
#endif

Expand Down Expand Up @@ -150,17 +145,30 @@ namespace refresh
{
std::string file_name;
size_t io_buffer_size;
FILE* file = nullptr;
bool test_extension = true;
FILE* file;
bool test_extension;

void _open()
{
file = fopen(file_name.c_str(), "rb");

if (!file)
return;

setvbuf(file, nullptr, _IOFBF, io_buffer_size);
buffer_released = true;
}

public:
stream_in_file(const std::string& file_name, size_t io_buffer_size = 16 << 20, size_t buffer_size = 8 << 20, bool test_extension = true) :
stream_in_buffered(buffer_size),
file_name(file_name),
io_buffer_size(io_buffer_size),
test_extension(test_extension)
file_name{ file_name },
io_buffer_size{ io_buffer_size },
file{ nullptr },
test_extension{test_extension}
{
open(file_name);
// open(file_name);
_open();
}

virtual ~stream_in_file()
Expand All @@ -175,16 +183,9 @@ namespace refresh
if (file)
close();

file = fopen(file_name.c_str(), "rb");

if (!file)
return false;

setvbuf(file, nullptr, _IOFBF, io_buffer_size);

buffer_released = true;
_open();

return true;
return file != nullptr;
}

virtual bool close()
Expand Down
Loading

0 comments on commit c898e1e

Please sign in to comment.