Skip to content

Commit

Permalink
Merge pull request #20 from MJRasicci/bug/posix-file-permissions
Browse files Browse the repository at this point in the history
Add tests to validate successful execution of the tailwind cli binary
  • Loading branch information
MJRasicci authored Mar 25, 2023
2 parents afc007d + 291ed07 commit 55994d4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Release
name: Build, Test & Release

on:
workflow_dispatch:
Expand All @@ -19,12 +19,31 @@ env:
MINVERBUILDMETADATA: build.${{github.run_number}}

jobs:
build:
name: Build-${{matrix.os}}
test:
name: Test-${{matrix.os}}
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ windows-latest ]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test

build:
name: Build Package
if: github.event_name == 'push' || github.event_name == 'release'
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -43,7 +62,7 @@ jobs:
with:
name: ${{matrix.os}}
path: "./nupkgs/*.nupkg"

push-github:
name: Push GitHub Package
needs: build
Expand All @@ -65,7 +84,7 @@ jobs:
- name: Dotnet NuGet Push
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GH_PACKAGES_TOKEN }} --source github --skip-duplicate
shell: pwsh

push-nuget:
name: Push NuGet Package
needs: build
Expand Down
19 changes: 19 additions & 0 deletions Tests/Tailwind.MSBuild.UnitTests/GetTailwindCliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Tailwind.MSBuild.Tests;
using Tailwind.MSBuild.Tests.Common;
using Tailwind.MSBuild.Tasks;
using FluentAssertions;
using System.Diagnostics;

public class GetTailwindCliTests : IClassFixture<TaskFixture<GetTailwindCLI>>
{
Expand All @@ -28,6 +29,24 @@ public void GetTailwindCli_Succeeds()
success.Should().BeTrue();
File.Exists(getTailwindCli.StandaloneCliPath).Should().BeTrue();

// Make sure the file is able to be executed (checks Posix file permissions)
using var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = getTailwindCli.StandaloneCliPath,
Arguments = $"-h",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
}
};

process.Start();
process.WaitForExit();
process.ExitCode.Should().Be(0);

Directory.Delete(getTailwindCli.RootInstallPath, true);
}

Expand Down

0 comments on commit 55994d4

Please sign in to comment.