Skip to content

[.github/workflows/github-actions.yml] Add missing vcpkg.json #248

[.github/workflows/github-actions.yml] Add missing vcpkg.json

[.github/workflows/github-actions.yml] Add missing vcpkg.json #248

name: CI for Linux, Windows, macOS
on:
push:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
name: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: mkdir
run: mkdir build
- name: Install dependencies for macOS
run: brew install pkg-config libarchive
if: matrix.os == 'macos-latest'
- name: Install dependencies for Ubuntu
run: sudo apt-get install -y libcurl4-openssl-dev libarchive-dev
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 (Windows)
run: ./vcpkg/vcpkg install --classic --triplet "${{ runner.arch }}-${{ runner.os }}" "$(jq '.dependencies[] | select(type == "string")' vcpkg.json)"
if: matrix.os == 'windows-latest' && steps.cache-vcpkg.outputs.cache-hit != 'true'
- name: Install vcpkg ports (macOS, Linux)
run: ./vcpkg/vcpkg install --classic "$(jq '.dependencies[] | select(type == "string")')"
if: matrix.os != 'windows-latest' && 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" ..
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: |
echo "${{ 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'