Skip to content

Commit

Permalink
vcpkg GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Feb 13, 2025
1 parent 476faef commit d5e3895
Showing 1 changed file with 81 additions and 4 deletions.
85 changes: 81 additions & 4 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push]

jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
Expand All @@ -13,22 +15,36 @@ jobs:
steps:
- uses: actions/checkout@v4

# # Enable this if you want specific version of vcpkg
# # For openmind tag "2020.06"
# - name: Configure Vcpkg
# shell: bash
# run: |
# cd ${{ matrix.vcpkg_dir }}
# git fetch origin --tags
# git reset --hard 2020.06
# if [ "$RUNNER_OS" == "Windows" ]; then
# ./bootstrap-vcpkg.bat
# else
# ./bootstrap-vcpkg.sh
# fi

- name: Cache vcpkg
uses: actions/cache@v4
with:
with:
path: |
${{github.workspace}}/vcpkg
!${{github.workspace}}/vcpkg/buildtrees
!${{github.workspace}}/vcpkg/packages
!${{github.workspace}}/vcpkg/downloads
${{ github.workspace }}/build/bin/Db*.solutions
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
restore-keys: |
${{ runner.os }}-vcpkg-

- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build autoconf automake autoconf-archive
cmake --version
Expand All @@ -40,7 +56,7 @@ jobs:
if: runner.os == 'macOS'
env:
VCPKG_PYTHON3: $(which python3)
run: |
run: |
echo "VCPKG_PYTHON3=$VCPKG_PYTHON3" >> $GITHUB_ENV
brew update
brew install cmake ninja autoconf automake autoconf-archive
Expand Down Expand Up @@ -75,3 +91,64 @@ jobs:
- name: Check
working-directory: ${{github.workspace}}/build
run: ctest . -j ${{steps.cpu-cores.outputs.count}} -E "ts" --rerun-failed --output-on-failure


- name: List runtime dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
ldd ./install/bin/openmind
elif [ "$RUNNER_OS" == "macOS" ]; then
otool -L ./install/bin/openmind
fi
- name: Package
id: create_artifact
shell: bash
run: |
mkdir release
if [ "$RUNNER_OS" == "Windows" ]; then
ls ./install
7z a -r openmind.zip ./install/*
else
cd ./install
zip -r ./../openmind.zip *
cd ..
fi
name=openmind-${{ matrix.suffix }}-$(git describe --always).zip
mv -v ./openmind.zip release/${name}
echo "::set-output name=name::${name}"
echo "::set-output name=path::release/${name}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Release
path: release

- name: Create Changelog
id: create_changelog
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
last_tag=$(git describe --tags --abbrev=0 @^ || true)
if [ -z "$last_tag" ]; then
git log --oneline --format="%C(auto) %h %s" > changelog.txt
else
git log --oneline --format="%C(auto) %h %s" ${last_tag}..@ > changelog.txt
fi
cat changelog.txt
- name: Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
artifacts: ${{ steps.create_artifact.outputs.path }}
allowUpdates: true
artifactContentType: application/zip
bodyFile: changelog.txt
draft: false
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d5e3895

Please sign in to comment.