fix(ci): Properly pass vcpkg path to env for Windows builds #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| release: | |
| types: [created] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact-suffix: linux-x64 | |
| shared-lib: libarkilian.so | |
| static-lib: libarkilian.a | |
| - os: macos-latest | |
| artifact-suffix: darwin-x64 | |
| shared-lib: libarkilian.dylib | |
| static-lib: libarkilian.a | |
| - os: windows-latest | |
| artifact-suffix: windows-x64 | |
| shared-lib: arkilian.dll | |
| static-lib: arkilian.lib | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev | |
| - name: Install Dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| $vcpkgPath = "${{ runner.temp }}/vcpkg" | |
| git clone https://github.com/microsoft/vcpkg.git $vcpkgPath | |
| & "$vcpkgPath/bootstrap-vcpkg.bat" | |
| & "$vcpkgPath/vcpkg" install curl:x64-windows | |
| echo "VCPKG_ROOT=$vcpkgPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Configure CMake (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DARKILIAN_BUILD_EXAMPLES=OFF | |
| shell: pwsh | |
| - name: Configure CMake (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DARKILIAN_BUILD_EXAMPLES=OFF | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Upload Build Artifacts (Shared) | |
| if: github.event_name == 'release' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./build/${{ matrix.shared-lib }} | |
| asset_name: ${{ matrix.shared-lib }} | |
| asset_content_type: application/octet-stream | |
| - name: Upload Build Artifacts (Static) | |
| if: github.event_name == 'release' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./build/${{ matrix.static-lib }} | |
| asset_name: ${{ matrix.static-lib }} | |
| asset_content_type: application/octet-stream | |
| - name: Upload Header | |
| if: github.event_name == 'release' && matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./src/class.h | |
| asset_name: class.h | |
| asset_content_type: text/plain | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev | |
| - name: Configure CMake | |
| run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DARKILIAN_BUILD_EXAMPLES=ON | |
| - name: Build | |
| run: cmake --build build --config Debug | |
| - name: Run Example | |
| run: ./build/arkilian_example |