aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 14a8134f880f1744ea6b6ae4091cbe37fa245a98 (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
name: Test

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

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        platform: [x86, x64]
        env: ['', 'winsymlinks:nativestrict']
        hardlinks: [0, 1]

        include:
          - {env: '', env_descr: 'nativestrict: 0'}
          - {env: 'winsymlinks:nativestrict', env_descr: 'nativestrict: 1'}

          - {hardlinks: 0, hardlinks_descr: 'Hardlinks: 0'}
          - {hardlinks: 1, hardlinks_descr: 'Hardlinks: 1'}

    runs-on: windows-2019

    name: '${{ matrix.platform }} / ${{ matrix.env_descr }} / ${{ matrix.hardlinks_descr }}'

    defaults:
      run:
        shell: pwsh

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

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

      - name: Set up Cygwin
        uses: ./
        with:
          platform: '${{ matrix.platform }}'
          install-dir: C:\cg
          packages: cmake gcc python3
          env: '${{ matrix.env }}'
          hardlinks: '${{ matrix.hardlinks }}'

      - name: Run bash
        run: |
          $((Get-Command bash.exe).Path -eq 'C:\cg\bin\bash.exe') -or $(throw (Get-Command bash.exe))
          $output = bash.exe --login -c 'echo foobar'
          $($output -eq 'foobar') -or $(throw $output)

      - name: Run cmake
        run: |
          $((Get-Command cmake.exe).Path -eq 'C:\cg\bin\cmake.exe') -or $(throw (Get-Command cmake.exe))
          cmake.exe --version

      - name: Check CYGWIN environment variable
        run: |
          $(Test-Path env:CYGWIN) -or $(throw '%CYGWIN% is not set!')
          $($env:CYGWIN -eq '${{ matrix.env }}') -or $(throw "Unexpected %CYGWIN% value: $env:CYGWIN")

      - name: python3 is a symlink
        run: |
          $(Get-Command python3.exe -ErrorAction SilentlyContinue) -and $(throw (Get-Command python3.exe))
        if: '!matrix.hardlinks'

      - name: python3 is a hardlink
        run: |
          $((Get-Command python3.exe).Path -eq 'C:\cg\bin\python3.exe') -or $(throw (Get-Command python3.exe))
          python3.exe --version
        if: matrix.hardlinks

  shell_igncr:
    name: 'shell: -o igncr'
    runs-on: windows-2019
    steps:
      - name: Checkout
        uses: actions/checkout@v2

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

      - name: Set up Cygwin
        uses: ./

      - name: Run basic commands
        run: |
          basic() {
              ls -Al
              pwd
          }
          basic
        shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'

  shell_shellopts:
    name: 'shell: SHELLOPTS'
    runs-on: windows-2019
    steps:
      - name: Checkout
        uses: actions/checkout@v2

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

      - name: Set up Cygwin
        uses: ./

      - name: Run basic commands
        run: |
          basic() {
              ls -Al
              pwd
          }
          basic
        shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail '{0}'
        env:
          SHELLOPTS: igncr