feat: adjust for usage with circleci workflows

This commit is contained in:
Jose Diaz-Gonzalez
2020-06-19 22:38:47 -04:00
parent e9ecc98b3d
commit c9e24a055c

View File

@@ -1,41 +1,111 @@
version: 2 version: 2.1
jobs:
build: commands:
machine: init-tests:
image: ubuntu-1604:201903-01 description: "Setup dokku for testing"
parallelism: 4
steps: steps:
- checkout - checkout
- run: | - attach_workspace:
make ci-dependencies at: /home/circleci/project
- run: |
./tests/ci/setup.sh
- run: |
echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup
- run: |
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to ens4
ifconfig
sudo ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev ens4
- run: |
case $CIRCLE_NODE_INDEX in
0) sudo -E make -e lint-ci go-tests ci-go-coverage ;;
1) sudo -E make -e deploy-test-checks-root deploy-test-config ;;
2) sudo -E make -e deploy-test-multi ;;
3) sudo -E make -e deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;;
esac
- run: - run:
name: resolve dokku.me
command: |
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to eth0
ifconfig
sudo ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev eth0
- run:
name: install ci-dependencies
command: make ci-dependencies
- run:
name: setup tests
command: ./tests/ci/setup.sh
- run:
name: dokku cleanup:skip
command: echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup
- run:
name: dokku report
command: dokku report
executors:
default:
machine:
image: ubuntu-1604:201903-01
working_directory: /home/circleci/project
jobs:
build:
executor: default
steps:
- checkout
- run:
name: build package
command: ./tests/ci/setup.sh build
- persist_to_workspace:
root: /home/circleci/project
paths:
- build
docker-deploy-tests:
executor: default
steps:
- init-tests
- run:
name: test docker deploys
shell: /bin/bash shell: /bin/bash
command: sudo -E make -e test-ci no_output_timeout: 20
no_output_timeout: 60m command: |
- run: |
if [ "${CIRCLE_NODE_INDEX}" == "0" ]; then
./tests/ci/setup.sh docker ./tests/ci/setup.sh docker
DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker
fi go-tests:
executor: default
parameters:
index:
type: integer
steps:
- init-tests
- run:
name: run pre-tests
command: |
case << parameters.index >> in
0) sudo -E make -e lint-ci go-tests ci-go-coverage ;;
1) sudo -E make -e deploy-test-checks-root deploy-test-config ;;
2) sudo -E make -e deploy-test-multi ;;
3) sudo -E make -e deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;;
esac
- store_artifacts: - store_artifacts:
path: ./coverage.out path: ./coverage.out
unit-tests:
executor: default
parameters:
index:
type: integer
steps:
- init-tests
- run:
shell: /bin/bash
command: sudo -E make -e test-ci-<< parameters.index >>
no_output_timeout: 60m
- store_artifacts: - store_artifacts:
path: ./test-results path: ./test-results
destination: test-results destination: test-results
- store_test_results: - store_test_results:
path: test-results path: test-results
workflows:
workflow:
jobs:
- build
- docker-deploy-tests:
requires:
- build
- go-tests:
matrix:
parameters:
index: [0, 1, 2, 3]
requires:
- build
- unit-tests:
matrix:
parameters:
index: [0, 1, 2, 3, 4]
requires:
- build