Skip to content

Commit

Permalink
Travis build since Github actions doesnt seem to support accessabilit…
Browse files Browse the repository at this point in the history
…y needed for osascript
  • Loading branch information
Johan Bloemberg authored and emekoi committed Apr 15, 2020
1 parent 1572e0e commit d5681ff
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 17 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/textmate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,33 @@ jobs:
test:
runs-on: macos-latest
steps:
- name: Textmate load success
- name: Install dependencies
run: |
set -vx
brew cask install textmate
brew install coreutils zig
- name: Textmate load success
run: |
# "install" bundle
mkdir -p "$HOME/Library/Application Support/TextMate/Bundles/"
ln -s $PWD "$HOME/Library/Application Support/TextMate/Bundles/Zig.tmbundle"
ln -s "$PWD" "$HOME/Library/Application Support/TextMate/Bundles/Zig.tmbundle"
# run TextMate, capture output
/Applications/TextMate.app/Contents/MacOS/TextMate | tee textmate.out &
# give TextMate some time to load
sleep 3
# don't expect the bundle to be mentioned here as that would indicate an error
# don't expect the bundle to be mentioned in output as that would indicate an error
! grep Zig.tmbundle textmate.out
# open source, use build macro from zig bundle to build and text executable
# open a sample source
mate hello.zig
osascript -e 'activate application "TextMate"'
# use Build command via keyboard shortcut
osascript -e 'activate application "TextMate"' -e 'tell application "System Events" to keystroke "b" using command down'
# wait for binary to be built
gtimeout 30 /bin/sh -c 'while ! ls hello 2>/dev/null; do sleep 1; done'
./hello
# debugging
# screencapture test.png; cat test.png | base64
osascript -e 'tell application "TextMate" to quit'
sleep 3
ls -l hello
./hello
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
os: osx

addons:
homebrew:
packages:
- zig
- coreutils # gtimeout
casks:
- textmate

script: |
# "install" bundle
mkdir -p "$HOME/Library/Application Support/TextMate/Bundles/"
ln -s $PWD "$HOME/Library/Application Support/TextMate/Bundles/Zig.tmbundle"
# run TextMate, capture output
/Applications/TextMate.app/Contents/MacOS/TextMate | tee textmate.out &
# don't expect the bundle to be mentioned in output as that would indicate an error
! grep Zig.tmbundle textmate.out
# open a sample source
mate hello.zig
# use Build command via keyboard shortcut
osascript -e 'activate application "TextMate"' -e 'tell application "System Events" to keystroke "b" using command down'
# wait for binary to be built
gtimeout 30 /bin/sh -c 'while ! ls hello 2>/dev/null; do sleep 1; done'
./hello
# debugging
# screencapture test.png; cat test.png | base64
osascript -e 'tell application "TextMate" to quit'
Binary file removed TextMate.scpt
Binary file not shown.
7 changes: 5 additions & 2 deletions hello.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const std = @import("std");

pub fn main() !void {
const stdout = &std.io.getStdOut().outStream().stream;
try stdout.print("Hello, {}!\n", .{"world"});
// If this program is run without stdout attached, exit with an error.
const stdout_file = try std.io.getStdOut();
// If this program encounters pipe failure when printing to stdout, exit
// with an error.
try stdout_file.write("Hello, world!\n");
}
Binary file removed test.png
Binary file not shown.
Empty file removed textmate.out
Empty file.

0 comments on commit d5681ff

Please sign in to comment.