Skip to content

Update to 1.0.6

Update to 1.0.6 #429

Workflow file for this run

name: CI
on:
push:
branches:
- main
- dev
tags:
- v*
pull_request:
branches:
- main
- dev
env:
Bin: ./bin/release # Where to put release binaries
HashDir: ./hash # Where to put hashes of binaries
DepsDir: ./deps # Where to put local libs (primarily for Windows builds)
jobs:
binary:
strategy:
matrix:
include:
# Release builds
# astroterm-linux-x86_64
# Use an older Ubuntu version to ensure compatibility with older C libraries
- os: ubuntu-20.04
suffix: linux
compiler: gcc
arch: x86_64
# astroterm-darwin-aarch64
- os: macos-latest
suffix: darwin
compiler: clang
arch: aarch64
# astroterm-darwin-x86_64
- os: macos-13
suffix: darwin
compiler: clang
arch: x86_64
# astroterm-win-x86_64
- os: windows-latest
suffix: win
compiler: cl #mscv
arch: x86_64
# Coverage build
- os: ubuntu-20.04
suffix: linux
arch: x86_64
compiler: gcc
coverage: true
# Build with bsc5 ASCII
- os: ubuntu-20.04
suffix: linux
arch: x86_64
compiler: gcc
ascii: true
- os: windows-latest
suffix: win
compiler: cl #mscv
ascii: true
fail-fast: false
runs-on: ${{ matrix.os }}
env:
BinaryName: ${{ matrix.suffix == 'win' && format('astroterm-{0}-{1}.exe', matrix.suffix, matrix.arch) || format('astroterm-{0}-{1}', matrix.suffix, matrix.arch)}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
# ------------------------------------------------------------------------
# Linux Dependencies
# ------------------------------------------------------------------------
# gcovr is for coverage build
- name: Install Linux Dependencies
if: matrix.suffix == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y \
python3-pip \
python3-setuptools \
ninja-build \
build-essential \
xxd \
wget \
pkg-config \
libncurses-dev \
libargtable2-dev
pip3 install meson gcovr
# ------------------------------------------------------------------------
# macOS Dependencies
# ------------------------------------------------------------------------
# Use argtable2 since argtable3 is only available as a dylib
- name: Install macOS Dependencies
if: matrix.suffix == 'darwin'
run: |
brew update
brew install \
meson \
ninja \
ncurses \
argtable
# ------------------------------------------------------------------------
# Windows Dependencies
# ------------------------------------------------------------------------
- name: Setup Python
if: matrix.suffix == 'win'
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Python Dependencies
if: matrix.suffix == 'win'
run: pip install meson ninja
- name: Prepare MSVC
if: matrix.suffix == 'win'
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
# The most up to date release of PDCurses is outdated,
# so we clone directly
- name: Clone and Build PDCurses
if: matrix.suffix == 'win'
run: |
mkdir ${{ env.DepsDir }}/lib
mkdir ${{ env.DepsDir }}/include
cd ${{ env.DepsDir }}
git clone https://github.com/wmcbrine/PDCurses/
cd PDCurses/wincon
nmake -f Makefile.vc WIDE=Y UTF8=Y
copy pdcurses.lib ../../lib
copy ../curses.h ../../include
copy ../panel.h ../../include
# Couldn't get Argtable3 to build nicely so we just use Argtable2 for Windows
- name: Download and Build Argtable2
if: matrix.suffix == 'win'
run: |
cd ${{ env.DepsDir }}
curl -L -o argtable2-13.tar.gz http://prdownloads.sourceforge.net/argtable/argtable2-13.tar.gz
tar -xzf argtable2-13.tar.gz
cd ./argtable2-13\src
nmake -f Makefile.nmake
copy argtable2.lib ../../lib
copy argtable2.h ../../include
# ------------------------------------------------------------------------
# Build and test
# ------------------------------------------------------------------------
- name: Download BSC5
env:
URL: ${{ matrix.ascii && 'https://web.archive.org/web/20250114171002if_/http://tdc-www.harvard.edu/catalogs/ybsc5.gz' || 'https://web.archive.org/web/20231007085824if_/http://tdc-www.harvard.edu/catalogs/BSC5' }}
Path: ${{ matrix.ascii && './data/ybsc5.gz' || './data/bsc5' }}
run: |
${{ matrix.suffix == 'win' && format('Invoke-WebRequest -OutFile {0} -Uri {1}', env.Path, env.URL) || format('curl -L -o {0} {1}', env.Path, env.URL) }}
- name: Unzip ASCII BSC5
if: matrix.ascii
run: |
cd data
${{ matrix.suffix == 'win' && '7z x ybsc5.gz -so > ybsc5' || 'gunzip ybsc5.gz' }}
ls
# Create a static release
- name: Build
env:
CC: ${{ matrix.compiler }}
BuildFlag: ${{ matrix.coverage && '-Db_coverage=true' || '--buildtype=release -Dprefer_static=true'}}
run: |
meson setup build $BuildFlag
meson compile --verbose -C build
- name: Test
run: |
meson test -v -C build
# ------------------------------------------------------------------------
# Compute Coverage
# ------------------------------------------------------------------------
- name: Generate Code Coverage Reports
if: matrix.coverage
run: |
ninja coverage-xml -C build
- name: Upload Coverage
if: matrix.coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: build/meson-logs/coverage.xml
if-no-files-found: error
# ------------------------------------------------------------------------
# Generate Hash
# ------------------------------------------------------------------------
- name: Generate Hash
run: |
mkdir -p ${{ env.HashDir }}
${{ matrix.suffix == 'win' && 'certutil -hashfile build/astroterm.exe SHA256' || 'shasum -a 256 build/astroterm' }} > ${{ env.HashDir }}/${{ env.BinaryName }}.sha256
- name: Upload Hash
if: ${{ !matrix.coverage && !matrix.ascii }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BinaryName }}.sha256
path: ${{ env.HashDir }}/*
if-no-files-found: error
# ------------------------------------------------------------------------
# Upload Binary
# ------------------------------------------------------------------------
- name: Rename Binary File
if: ${{ !matrix.coverage && !matrix.ascii }}
run: |
mkdir -p ${{env.Bin}}
mv ${{ matrix.suffix == 'win' && 'build/astroterm.exe' || 'build/astroterm' }} ${{env.Bin}}/${{env.BinaryName}}
- name: Upload Binary
if: ${{ !matrix.coverage && !matrix.ascii }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BinaryName }}
path: ${{env.Bin}}
if-no-files-found: error
# Ensure binaries are standalone
run:
needs: binary
strategy:
matrix:
include:
# astroterm-linux-x86_64
- os: ubuntu-20.04
suffix: linux
arch: x86_64
# astroterm-darwin-aarch64
- os: macos-latest
suffix: darwin
arch: aarch64
# astroterm-darwin-x86_64
- os: macos-13
suffix: darwin
arch: x86_64
# astroterm-win-x86_64
- os: windows-latest
suffix: win
arch: x86_64
fail-fast: false
runs-on: ${{ matrix.os }}
env:
BinaryName: ${{ matrix.suffix == 'win' && format('astroterm-{0}-{1}.exe', matrix.suffix, matrix.arch) || format('astroterm-{0}-{1}', matrix.suffix, matrix.arch)}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Release Binary
uses: actions/download-artifact@v4
with:
pattern: ${{ env.BinaryName }}*
path: ${{env.Bin}}
merge-multiple: true
- name: List Release Directiory
run: |
ls -l ${{env.Bin}}
- name: Set Executable Permissions
if: matrix.suffix != 'win'
run: |
chmod +x ${{env.Bin}}/${{ env.BinaryName }}
- name: Run Binary
run: |
${{env.Bin}}/${{ env.BinaryName }} -v
code-quality:
runs-on: ubuntu-latest
needs: run
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Code Quality Tools
run: |
sudo apt-get install -y cppcheck clang-format
- name: Run Cppcheck
run: |
cppcheck \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
--suppress=missingInclude \
--suppress=style \
--error-exitcode=1 \
-i src/strptime.c \
-I include \
src/
- name: Check Formatting
run: |
sh ./scripts/format.sh --check
upload-coverage:
runs-on: ubuntu-latest
needs: code-quality
steps:
- name: Download Coverage Reports
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/coverage.xml
fail_ci_if_error: true
publish-release:
runs-on: ubuntu-latest
needs: [binary, run, code-quality, upload-coverage]
permissions:
contents: write
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
steps:
- name: Download Release Binaries
uses: actions/download-artifact@v4
with:
pattern: astroterm-*
path: ${{env.Bin}}
merge-multiple: true
- name: Verify Version Consistency
run: |
TAG_VERSION="${{ github.ref_name }}"
BINARY_PATH="${{env.Bin}}/astroterm-linux-x86_64"
# Ensure the binary is executable
chmod +x "$BINARY_PATH"
# Extract version from binary output
BINARY_VERSION=$($BINARY_PATH -v | awk '{print $2}')
# Remove the "v" prefix if present
if [[ "$TAG_VERSION" == v* ]]; then
TAG_VERSION=${TAG_VERSION:1}
fi
# Compare the two versions
if [ "$TAG_VERSION" != "$BINARY_VERSION" ]; then
echo "Error: Git tag version ($TAG_VERSION) does not match binary version ($BINARY_VERSION)."
exit 1
fi
echo "Success: Git tag version ($TAG_VERSION) matches binary version ($BINARY_VERSION)."
- name: List files in release folder
run: ls -al ${{env.Bin}}
- name: Update GitHub Release
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0
with:
artifacts: ${{env.Bin}}/*
generateReleaseNotes: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.ref_name }}