chore: add basic e2e test to shorebird_cli (#773)
This commit is contained in:
@@ -9,15 +9,12 @@ env:
|
||||
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
|
||||
|
||||
jobs:
|
||||
verify_cli_installation:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
package: [packages/shorebird_cli]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -25,11 +22,42 @@ jobs:
|
||||
- name: 📚 Git Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🐦 Verify Shorebird Installation (${{ matrix.os }})
|
||||
- name: Add Shorebird to macOS/Linux PATH
|
||||
shell: bash
|
||||
if: runner.os != 'Windows'
|
||||
run: echo "${GITHUB_WORKSPACE}/bin/" >> $GITHUB_PATH
|
||||
|
||||
- name: 🐦 Verify Shorebird Installation (macOS / Linux)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
if [[ $(./bin/shorebird --version) =~ "Shorebird Engine • revision" ]]; then
|
||||
if [[ $(shorebird --version) =~ "Shorebird Engine • revision" ]]; then
|
||||
echo '✅ Shorebird CLI is installed!'
|
||||
else
|
||||
echo '❌ Shorebird CLI is not installed.'
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Add Shorebird to Windows PATH
|
||||
shell: pwsh
|
||||
if: runner.os == 'Windows'
|
||||
run: Add-Content $env:GITHUB_PATH "${env:GITHUB_WORKSPACE}\bin"
|
||||
|
||||
- name: 🐦 Verify Shorebird Installation (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
$shorebird_version = shorebird --version
|
||||
if ($shorebird_version -match "Shorebird Engine") {
|
||||
Write-Output "✅ Shorebird CLI is installed!"
|
||||
} else {
|
||||
Write-Output "❌ Shorebird CLI is not installed."
|
||||
exit 1
|
||||
}
|
||||
shell: pwsh
|
||||
|
||||
- name: 🎯 Set up dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: dart test integration_test
|
||||
working-directory: packages/shorebird_cli
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('--version', () async {
|
||||
final result = await Process.run(
|
||||
'shorebird',
|
||||
['--version'],
|
||||
runInShell: true,
|
||||
);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(
|
||||
result.stdout,
|
||||
stringContainsInOrder(['Shorebird Engine', 'revision']),
|
||||
);
|
||||
expect(result.exitCode, 0);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user