Skip to content

[acquire/tests/test_*.h] Increase test coverage ; [*.h] Modify code f… #278

[acquire/tests/test_*.h] Increase test coverage ; [*.h] Modify code f…

[acquire/tests/test_*.h] Increase test coverage ; [*.h] Modify code f… #278

name: CI for Linux, Windows, macOS
on:
push:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
name: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: mkdir
run: mkdir build
- name: Install dependencies for macOS
run: brew install libarchive libbsd pkg-config
if: matrix.os == 'macos-latest'
- name: Install dependencies for Ubuntu
run:
sudo apt-get install -y cmake gcc libarchive-dev libbsd-dev libc-dev libcurl4-openssl-dev librhash-dev libssl-dev make ninja-build pkg-config
if: matrix.os == 'ubuntu-latest'
- name: Cache vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
path: vcpkg
key: ${{ runner.os }}-${{ hashFiles('**/vcpkg.json') }}-43a81834cc9d6d953bd5ca8153437ef65fed86ab
- name: checkout vcpkg
uses: actions/checkout@v4
with:
repository: "offscale/vcpkg"
ref: project0
path: vcpkg
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
- name: Setup vcpkg (Windows)
run: vcpkg\bootstrap-vcpkg.bat
shell: cmd
if: matrix.os == 'windows-latest'
- name: Setup vcpkg (non-Windows)
run: ./vcpkg/bootstrap-vcpkg.sh
if: matrix.os != 'windows-latest'
- name: Install vcpkg ports --triplet "${{ runner.arch }}-${{ runner.os }}"
run: ./vcpkg/vcpkg install --classic $(jq -r '.dependencies[] | select(type == "string")' vcpkg.json)
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
- name: configure (with vcpkg on Windows)
working-directory: ./build
run: |
cmake -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_TOOLCHAIN_FILE="%GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ..
shell: cmd
if: matrix.os == 'windows-latest'
- name: configure (with vcpkg on non-Windows)
working-directory: ./build
run: |
cmake -DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DCMAKE_C_COMPILER="$(which gcc)" \
-DCMAKE_MAKE_PROGRAM="$(which make)" \
..
if: matrix.os != 'windows-latest'
- name: build
working-directory: ./build
run: cmake --build .
- name: test
working-directory: ./build
run: ctest --output-on-failure -C Debug .
- name: release (Ubuntu)
working-directory: ./build
run: |
printf '%s' "${{ secrets.GITHUB_TOKEN }}" > .token
gh auth login --with-token < .token
rm .token
gh release delete -y amalgamation || true
gh release create amalgamation --target master "src/acquire.h"
if: matrix.os == 'ubuntu-latest'