Skip to content

Commit

Permalink
build-aux/.circleci: Add
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeShu committed Sep 5, 2019
1 parent d20d098 commit 45ed837
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: 2.1

jobs:

"Ubuntu 16-04 VM":
machine:
image: "ubuntu-1604:201903-01"
steps:
- run:
name: "Set environment"
command: |
{
echo export build_aux_expected_GOHOSTOS=linux
echo export build_aux_expected_GOHOSTARCH=amd64
echo export build_aux_expected_FLOCK=/usr/bin/flock
} >> "$BASH_ENV"
- run: sudo apt update && sudo apt install bats

- checkout
- run: bats tests/

"macOS 10-13-6 VM":
macos:
xcode: "10.1.0"
steps:
- run:
name: "Set environment"
command: |
{
echo export build_aux_expected_GOHOSTOS=darwin
echo export build_aux_expected_GOHOSTARCH=amd64
echo export build_aux_expected_FLOCK=
} >> "$BASH_ENV"
- restore_cache:
name: "Restore brew cache"
keys:
- brew-{{ arch }}
- run: brew install bats
- save_cache:
name: "Save brew cache"
key: brew-{{ arch }}
paths:
- "/usr/local/Homebrew"

- checkout
- run: bats tests/

workflows:
"build-aux Test Suite":
jobs:
- "Ubuntu 16-04 VM"
- "macOS 10-13-6 VM"
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ indent_style = space
[*.yaml]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
5 changes: 4 additions & 1 deletion tests/prelude.bats
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ load common
}

@test "prelude.mk: FLOCK" {
if ! type flock &>/dev/null && ! type go &>/dev/null; then
if ! type flock &>/dev/null && ! type go &>/dev/null && [[ -z "$build_aux_expected_FLOCK" ]]; then
skip
fi
check_executable prelude.mk FLOCK
if which flock &>/dev/null; then
[[ "$FLOCK" == "$(which flock)" ]]
fi
if [[ -n "$build_aux_expected_FLOCK" ]]; then
[[ "$FLOCK" == "$build_aux_expected_FLOCK" ]]
fi

# TODO: Check that $FLOCK behaves correctly
}
Expand Down
6 changes: 4 additions & 2 deletions tests/prelude_go.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
load common

@test "prelude_go.mk: GOHOSTOS" {
# TODO
[[ -n "$build_aux_expeced_GOHOSTOS" ]] || skip
check_expr_eq strict '$(GOHOSTOS)' "$build_aux_expeced_GOHOSTOS"
}

@test "prelude_go.mk: GOHOSTARCH" {
# TODO
[[ -n "$build_aux_expeced_GOHOSTARCH" ]] || skip
check_expr_eq strict '$(GOHOSTARCH)' "$build_aux_expeced_GOHOSTARCH"
}

@test "prelude_go.mk: _prelude.go.lock" {
Expand Down

0 comments on commit 45ed837

Please sign in to comment.