[ffigen] Add Windows CI (#399)
diff --git a/pkgs/ffigen/.github/workflows/test-package.yml b/pkgs/ffigen/.github/workflows/test-package.yml index 1b6b494..672f339 100644 --- a/pkgs/ffigen/.github/workflows/test-package.yml +++ b/pkgs/ffigen/.github/workflows/test-package.yml
@@ -37,7 +37,7 @@ run: dart analyze --fatal-infos if: always() && steps.install.outcome == 'success' - test: + test-linux: needs: analyze # This job requires clang-10 which is the default on 20.04 runs-on: ubuntu-20.04 @@ -55,7 +55,7 @@ - name: Run VM tests run: dart test --platform vm - mac-test: + test-mac: needs: analyze runs-on: macos-latest steps: @@ -76,3 +76,18 @@ with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: lcov.info + + test-windows: + needs: analyze + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1.0 + with: + sdk: stable + - name: Install dependencies + run: dart pub get + - name: Build test dylib and bindings + run: dart test/setup.dart + - name: Run VM tests + run: dart test --platform vm
diff --git a/pkgs/ffigen/test/native_test/native_test.dart b/pkgs/ffigen/test/native_test/native_test.dart index d98b686..4365214 100644 --- a/pkgs/ffigen/test/native_test/native_test.dart +++ b/pkgs/ffigen/test/native_test/native_test.dart
@@ -40,8 +40,10 @@ library.generateFile(file); try { - final actual = file.readAsStringSync(); - final expected = File(path.join(config.output)).readAsStringSync(); + final actual = file.readAsStringSync().replaceAll('\r', ''); + final expected = File(path.join(config.output)) + .readAsStringSync() + .replaceAll('\r', ''); expect(actual, expected); if (file.existsSync()) { file.delete();
diff --git a/pkgs/ffigen/test/setup.dart b/pkgs/ffigen/test/setup.dart index e660598..3439901 100644 --- a/pkgs/ffigen/test/setup.dart +++ b/pkgs/ffigen/test/setup.dart
@@ -8,16 +8,14 @@ import 'dart:async'; import 'dart:io'; -import 'package:path/path.dart' as path; - Future<void> _run(String subdir, String script) async { - final dir = path.join(path.dirname(Platform.script.path), subdir); - print('\nRunning $script in $dir'); - final args = ['run', path.join(dir, script)]; + final dir = Platform.script.resolve('$subdir/'); + print('\nRunning $script in ${dir.toFilePath()}'); + final args = ['run', dir.resolve(script).toFilePath()]; final process = await Process.start( Platform.executable, args, - workingDirectory: dir, + workingDirectory: dir.toFilePath(), ); unawaited(stdout.addStream(process.stdout)); unawaited(stderr.addStream(process.stderr));
diff --git a/pkgs/ffigen/test/test_utils.dart b/pkgs/ffigen/test/test_utils.dart index 196da1e..314f8aa 100644 --- a/pkgs/ffigen/test/test_utils.dart +++ b/pkgs/ffigen/test/test_utils.dart
@@ -51,8 +51,10 @@ library.generateFile(file); try { - final actual = file.readAsStringSync(); - final expected = File(path.joinAll(pathToExpected)).readAsStringSync(); + final actual = file.readAsStringSync().replaceAll('\r', ''); + final expected = File(path.joinAll(pathToExpected)) + .readAsStringSync() + .replaceAll('\r', ''); expect(actual, expected); if (file.existsSync()) { file.delete();