diff options
Diffstat (limited to '')
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | .github/workflows/test.yml | 49 | ||||
-rw-r--r-- | LICENSE.txt | 21 | ||||
-rw-r--r-- | action.yml | 58 |
4 files changed, 129 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..99c3ca7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +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: + os: [windows-2019] + platform: [x86, x64] + + include: + - {os: windows-2019, name: Windows Server 2019} + + runs-on: '${{ matrix.os }}' + + name: '${{ matrix.name }} / ${{ matrix.platform }}' + + defaults: + run: + shell: pwsh + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Cygwin + id: setup + uses: ./ + with: + platform: '${{ matrix.platform }}' + install-dir: C:\cg + packages: cmake gcc + + - name: Run bash + run: | + $output = C:\cg\bin\bash.exe --login -c 'echo foobar' + $($output -eq 'foobar') -or $(throw $output) + + - name: Run cmake + run: | + C:\cg\bin\cmake.exe --version diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ab8c3ff --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..75b8764 --- /dev/null +++ b/action.yml @@ -0,0 +1,58 @@ +name: Install Cygwin +description: Install Cygwin & packages + +inputs: + platform: + description: Target platform + required: false + default: x64 + install-dir: + description: Installation directory + required: false + default: C:\tools\cygwin + packages: + description: Packages to install, separated by a space + required: false + +runs: + using: composite + steps: + - run: | + New-Variable os -Value ('${{ runner.os }}') -Option Constant + + New-Variable windows_host -Value ($os -eq 'Windows') -Option Constant + + New-Variable x64 -Value ('${{ inputs.platform }}' -eq 'x64') -Option Constant + New-Variable install_dir -Value '${{ inputs.install-dir }}' -Option Constant + New-Variable packages -Value '${{ inputs.packages}}' -Option Constant + + if ($windows_host) { + echo 'CYGWIN=winsymlinks:nativestrict' >> $env:GITHUB_ENV + + $choco_params = @( + 'install', + '-y', + '--no-progress', + '--params', "/InstallDir:$install_dir" + ) + if (!$x64) { + $choco_params += '--x86' + } + $choco_params += 'cygwin' + + # Assuming that Cygwin is not installed when this is run. + choco.exe $choco_params + + echo (Join-Path $install_dir usr local bin) >> $env:GITHUB_PATH + # /usr/bin is really just /bin on Cygwin. + echo (Join-Path $install_dir bin) >> $env:GITHUB_PATH + + $pkg_list = $packages.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries) + + if ($pkg_list.Count -gt 0) { + choco.exe install -y --no-progress --source=cygwin $pkg_list + } + } else { + throw "Sorry, installing Cygwin is unsupported on $os" + } + shell: pwsh |