aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 694e942277aa8b5abbeac00e37b5e4dbca705f58 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                              
                            
                                             
                         

                

                                                                           
 

                                                           
 
                           
 
                                                                                            








                                 



                                         
                           



                                            
                             
                                  
                                              


                      

                                                                                                     



                                                      

                                                                                                        




                                                                                                      
 
                             
              
                                                                                                

                               
                              
              

                                                                                               
                            
 
              
                           
                           












                                         




                    
                                                                                      

                  
                           
                            




















                                                                             
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-latest

    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
          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: cc is a symlink
        run: |
          $(Get-Command cc.exe -ErrorAction SilentlyContinue) -and $(throw (Get-Command cc.exe))
        if: '!matrix.hardlinks'

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

  shell_igncr:
    runs-on: windows-latest
    name: 'shell: -o igncr'
    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:
    runs-on: windows-latest
    name: 'shell: SHELLOPTS'
    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