Skip to content

Commit

Permalink
Merge pull request dokku#226 from dokku/github-actions-attempt
Browse files Browse the repository at this point in the history
tests: migrate to github actions
  • Loading branch information
josegonzalez authored Apr 25, 2021
2 parents 0be882b + b58b3eb commit 76d5353
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 34 deletions.
29 changes: 0 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@ commands:
default: "3.7.0"
steps:
- checkout
- run: pyenv global << parameters.python_version >>
- run: make setup
- run: sudo sysctl -w vm.max_map_count=262144
- run:
command: |
make generate
if ! git diff --quiet README.md; then
echo "Please run `make generate`"
git status --short
git --no-pager diff README.md
exit 1
fi
- run: make test
- store_artifacts:
path: build
destination: build
- store_artifacts:
path: tmp/test-results
destination: test-results
- store_test_results:
path: tmp/test-results

executors:
machine:
Expand All @@ -45,16 +24,8 @@ jobs:
steps:
- build

build-version:
environment:
DOKKU_VERSION: v0.19.0
executor: machine
steps:
- build

workflows:
version: 2
build:
jobs:
- "build-master"
- "build-version"
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: CI

# yamllint disable-line rule:truthy
on:
pull_request:
branches:
- '*'
push:
branches:
- master

jobs:
unit-tests-master:
name: unit-tests
runs-on: ubuntu-18.04
strategy:
fail-fast: true
env:
DOKKU_VERSION: master

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7.x'

- run: make setup

- run: sudo sysctl -w vm.max_map_count=262144

- run: |
make generate
if ! git diff --quiet README.md; then
echo "Please run `make generate`"
git status --short
git --no-pager diff README.md
exit 1
fi
- run: make test

- uses: actions/upload-artifact@v2
if: failure()
with:
name: tmp/test-results
path: test-results

unit-tests-0_19_0:
name: unit-tests-0.19.0
runs-on: ubuntu-18.04
strategy:
fail-fast: true
env:
DOKKU_TAG: v0.19.0

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7.x'

- run: make setup

- run: sudo sysctl -w vm.max_map_count=262144

- run: |
make generate
if ! git diff --quiet README.md; then
echo "Please run `make generate`"
git status --short
git --no-pager diff README.md
exit 1
fi
- run: make test

- uses: actions/upload-artifact@v2
if: failure()
with:
name: tmp/test-results
path: test-results
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifneq ($(shell bats --version >/dev/null 2>&1 ; echo $$?),0)
brew install bats-core
endif
else
git clone https://github.com/josegonzalez/bats-core.git /tmp/bats
git clone https://github.com/bats-core/bats-core.git /tmp/bats
cd /tmp/bats && sudo ./install.sh /usr/local
rm -rf /tmp/bats
endif
Expand Down Expand Up @@ -63,7 +63,7 @@ unit-tests:
@echo running unit tests...
@mkdir -p tmp/test-results/bats
@cd tests && echo "executing tests: $(shell cd tests ; ls *.bats | xargs)"
cd tests && bats --formatter bats-format-junit -e -T -o ../tmp/test-results/bats *.bats
cd tests && bats --report-formatter junit --timing -o ../tmp/test-results/bats *.bats

tmp/xunit-reader:
mkdir -p tmp
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Official postgres plugin for dokku. Currently defaults to installing [postgres 1

## Requirements

- dokku 0.12.x+
- dokku 0.19.x+
- docker 1.8.x

## Installation

```shell
# on 0.12.x+
# on 0.19.x+
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
```

Expand Down
2 changes: 1 addition & 1 deletion bin/generate
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def main():
sponsors = re.search("\[([\"\w\s,_-]+)\]", line).group(1)
sponsors = [s.strip("\"") for s in sponsors.split(",")]

text = compile(service, version, variable, alias, image, scheme, ports, sponsors, unimplemented, "0.12.x+")
text = compile(service, version, variable, alias, image, scheme, ports, sponsors, unimplemented, "0.19.x+")

base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
readme_file = os.path.join(base_path, "README.md")
Expand Down
3 changes: 3 additions & 0 deletions tests/service_export.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ teardown() {
}

@test "($PLUGIN_COMMAND_PREFIX:export) success with SSH_TTY" {
if [[ -n "$GITHUB_WORKFLOW" ]]; then
skip "No tty is available on Github Actions"
fi
export SSH_TTY=`tty`
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
echo "output: $output"
Expand Down
3 changes: 3 additions & 0 deletions tests/service_import.bats
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ teardown() {
}

@test "($PLUGIN_COMMAND_PREFIX:import) error when data is not provided" {
if [[ -n "$GITHUB_WORKFLOW" ]]; then
skip "No tty is available on Github Actions"
fi
run dokku "$PLUGIN_COMMAND_PREFIX:import" l
assert_contains "${lines[*]}" "No data provided on stdin"
assert_failure
Expand Down

0 comments on commit 76d5353

Please sign in to comment.