aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/cygwin_static_libstdc++.yml
blob: aa5631d563ef237638b52e13ac00949bf89d4803 (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
# -static-libstdc++ is broken on Cygwin for some reason, as this workflow tries
# to demonstrate.  I don't know why exactly, but I'm not the only one with this
# problem:
#
#   * https://stackoverflow.com/q/46854365/514684
#   * https://sourceforge.net/p/stlplus/discussion/345536/thread/48c7fc9c17/?limit=25

name: Cygwin & -static-libstdc++

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

jobs:
  test:
    runs-on: windows-latest

    name: Test

    defaults:
      run:
        shell: pwsh

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

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

      - name: Set common variables
        uses: ./.github/actions/common-variables
        with:
          toolset: gcc
          cygwin: 1

      - name: Install Cygwin
        uses: egor-tensin/setup-cygwin@v3

      - name: Install GCC
        uses: egor-tensin/setup-gcc@v1
        with:
          cygwin: 1

      - name: Set up software environment
        uses: ./.github/actions/software-environment
        with:
          toolset: gcc

      - name: test.cpp
        run: |
          $src = @"
          #include <stdexcept>

          int main() {
              std::runtime_error x{"x"};
              std::runtime_error y{x};
              return 0;
          }
          "@

          echo $src > test.cpp

      - name: Build w/ -static-libstdc++
        run: C:\tools\cygwin\bin\g++.exe -static-libstdc++ -o test test.cpp
        continue-on-error: true

      - name: Should fail
        run: $(Test-Path test.exe -Type Leaf) -and $(throw "test.exe shouldn't have been built")

      - name: Build w/ --allow-multiple-definition
        run: C:\tools\cygwin\bin\g++.exe '-Wl,--allow-multiple-definition' -static-libstdc++ -o test test.cpp
        continue-on-error: true

      - name: Should succeed
        run: $(Test-Path test.exe -Type Leaf) -or $(throw "test.exe should have been built")