aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 80b8694b44451cbf22b6bf0cc0d8b089ab693c38 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Test

on:
  push:
  pull_request:
  schedule:
    # Weekly, at 5:45 AM on Friday (somewhat randomly chosen).
    - cron: '45 5 * * 5'
  workflow_dispatch:

jobs:
  old_and_new:
    strategy:
      matrix:
        version: [1.58.0, 1.74.0]
        os: [ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019]
        toolset: [auto, clang, gcc, mingw, msvc]

        exclude:
          # No Visual Studio on Linux.
          - {os: ubuntu-18.04, toolset: msvc}
          - {os: ubuntu-20.04, toolset: msvc}
          # GCC == MinGW-w64 on Windows.
          - {os: windows-2016, toolset: gcc}
          - {os: windows-2019, toolset: gcc}

    runs-on: '${{ matrix.os }}'

    name: '${{ matrix.version }} / ${{ matrix.os }} / ${{ matrix.toolset }}'

    defaults:
      run:
        shell: pwsh

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Cache Boost
        uses: actions/cache@v2.1.4
        with:
          path: '${{ runner.workspace }}/boost_*.tar.gz'
          key: 'boost-${{ matrix.version }}'

      - name: Clean up PATH
        uses: egor-tensin/cleanup-path@v2
        if: runner.os == 'Windows'

      - name: Set up GCC
        uses: egor-tensin/setup-gcc@v1
        if: matrix.toolset == 'gcc'

      - name: Set up MinGW
        uses: egor-tensin/setup-mingw@v2
        if: matrix.toolset == 'mingw' || (matrix.toolset == 'clang' && runner.os == 'Windows')

      - name: Set up Clang
        uses: egor-tensin/setup-clang@v1
        if: matrix.toolset == 'clang'

      - id: build
        name: Build Boost
        uses: ./
        with:
          version: '${{ matrix.version }}'
          toolset: '${{ matrix.toolset }}'
          configuration: Release
          libraries: filesystem program_options system

      - name: Check libraries
        run: |
          New-Variable os -Value '${{ runner.os }}' -Option Constant
          New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant

          New-Variable toolset -Value '${{ matrix.toolset }}' -Option Constant
          New-Variable librarydir -Value '${{ steps.build.outputs.librarydir }}' -Option Constant

          $prefix = 'libboost_'
          $ext = '.a'
          if ($windows_host -and $toolset -in @('auto', 'clang', 'msvc')) {
              $ext = '.lib'
          }

          $expected = @('filesystem', 'program_options', 'system')
          $expected = $expected | %{"$prefix$_$ext"}
          foreach ($lib in $expected) {
              $path = Join-Path $librarydir $lib
              $(Test-Path $path -Type Leaf) -or $(throw "Couldn't find Boost library at: $path")
          }

  different_configurations:
    strategy:
      matrix:
        os: [ubuntu-20.04, windows-2016, windows-2019]
        platform: [x64, x86]
        configuration: [Debug, Release]

    runs-on: '${{ matrix.os }}'

    name: '${{ matrix.os }} / ${{ matrix.platform }} / ${{ matrix.configuration }}'

    defaults:
      run:
        shell: pwsh

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Cache Boost
        uses: actions/cache@v2.1.4
        with:
          path: '${{ runner.workspace }}/boost_*.tar.gz'
          key: 'boost-${{ matrix.version }}'

      - name: Set up GCC
        uses: egor-tensin/setup-gcc@v1
        with:
          platform: '${{ matrix.platform }}'
        if: runner.os == 'Linux'

      - id: build
        name: Build Boost
        uses: ./
        with:
          version: 1.66.0
          toolset: auto
          platform: '${{ matrix.platform }}'
          configuration: '${{ matrix.configuration }}'
          libraries: filesystem program_options system