tests: migrate to github actions

This commit is contained in:
Jose Diaz-Gonzalez
2021-04-24 02:20:30 -04:00
parent 0be882b8a4
commit 63535f934d
3 changed files with 72 additions and 31 deletions

View File

@@ -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:
@@ -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"

70
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
---
name: CI
# yamllint disable-line rule:truthy
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'
jobs:
unit-tests:
name: unit-tests
runs-on: ubuntu-18.04
strategy:
fail-fast: true
matrix:
dokku-version:
- master
env:
DOKKU_VERSION: ${{ matrix.dokku-version }}
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
publish-test-results:
name: publish-test-results
needs: unit-tests
runs-on: ubuntu-16.04
if: success() || failure()
steps:
- name: download test-results
uses: actions/download-artifact@v2
with:
path: test-results
- name: Publish Unit Test Results
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.12
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: test-results/**/*.xml
comment_on_pr: false

View File

@@ -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
@@ -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