aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci-windows.yml
blob: fc109e8c34f95dc834d89859d58f2f2cbc1a4c32 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Windows CI
on:
  pull_request:
  push:
  release:
    types:
      - published
  schedule:
    - cron: '0 0 * * 0'
jobs:
  build:
    if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
    runs-on: windows-2025
    env:
      BUILD_TYPE: ${{ github.event_name == 'release' && 'Release' || 'Debug' }}
      CONAN_HOME: ${{ github.workspace }}/win/build/conan
    steps:
      - uses: actions/checkout@v6

      - name: Setup NSIS
        run: |-
          choco install nsis

      - name: Setup MSBuild
        uses: microsoft/setup-msbuild@v2.0.0
        with:
          msbuild-architecture: x64

      - name: Setup Conan
        uses: turtlebrowser/get-conan@v1.2

      - name: Create Conan profile
        run: |-
          conan profile detect
          (Get-Content ${{ env.CONAN_HOME }}/profiles/default).replace('build_type=Release', 'build_type=${{ env.BUILD_TYPE }}') | Set-Content ${{ env.CONAN_HOME }}/profiles/default
          (Get-Content ${{ env.CONAN_HOME }}/profiles/default).replace('compiler.cppstd=14', 'compiler.cppstd=17') | Set-Content ${{ env.CONAN_HOME }}/profiles/default
          Write-Output 'core.sources:download_urls=["origin", "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/"]' | Out-File -Append ${{ env.CONAN_HOME }}/global.conf

      - name: Try to restore libraries from the cache
        uses: actions/cache/restore@v5
        id: library-cache
        with:
          key: conan-${{ env.BUILD_TYPE }}-${{ hashFiles('win/conanfile.txt') }}
          path: ${{ env.CONAN_HOME }}/p

      - name: Install libraries
        working-directory: ${{ github.workspace }}/win/build
        run: |
          (Get-Content ../conanfile.txt).replace('##', '') | Set-Content ../conanfile.txt
          conan install .. --build missing --deployer runtime_deploy --deployer-folder extradll --output-folder .

      - name: Save libraries to the cache
        if: ${{ steps.library-cache.outputs.cache-hit != 'true' }}
        uses: actions/cache/save@v5
        with:
          key:  ${{ steps.library-cache.outputs.cache-primary-key }}
          path: ${{ env.CONAN_HOME }}/p

      - name: Run CMake
        working-directory: ${{ github.workspace }}/win/build
        env:
          LDFLAGS: /DEBUG:FASTLINK /INCREMENTAL
        run: |
          cmake -A x64 -D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -D CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -G "Visual Studio 17 2022" -Wdev ..

      - name: Build InspIRCd
        working-directory: ${{ github.workspace }}/win/build
        run: |
          msbuild PACKAGE.vcxproj /M:5 /P:Configuration=${{ env.BUILD_TYPE }} /P:Platform=x64 /VERBOSITY:MINIMAL

      - name: Upload installer
        if: "${{ github.event_name == 'release' }}"
        working-directory: ${{ github.workspace }}/win/build
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release upload ${{ github.event.release.tag_name }} $(Get-ChildItem InspIRCd-*.exe)