From 3c56a0c323fe43576fedd78082860779953fecde Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 8 Jun 2020 03:20:36 -0400 Subject: [PATCH] tests: modify to allow better running under github actions --- .github/workflows/ci.yaml | 101 +++++++++++++++++++++++++++++++------- tests.mk | 26 ++++++++++ 2 files changed, 108 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf5830693..686fbf8d6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: name: build path: build - ci: + unit-tests: env: GITHUB_NODE_INDEX: ${{ matrix.compiler }} name: ci.${{ matrix.index }} @@ -36,7 +36,87 @@ jobs: strategy: fail-fast: true matrix: - index: [0, 1, 2,3] + index: [0, 1, 2, 3, 4] + + steps: + - uses: actions/checkout@v2 + + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build + + - name: resolve dokku.me + run: | + # 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 + + - name: install ci-dependencies + run: make ci-dependencies + + - name: setup tests + run: ./tests/ci/setup.sh + + - name: dokku cleanup:skip + run: echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup + + - name: run ci + shell: bash + timeout-minutes: 60 + run: | + sudo -E make -e test-ci-${{ matrix.index }} + + - uses: actions/upload-artifact@v2 + with: + name: test-results-${{ matrix.index }} + path: test-results + + docker-deploy-tests: + env: + GITHUB_NODE_INDEX: ${{ matrix.compiler }} + name: ci.${{ matrix.index }} + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build + + - name: resolve dokku.me + run: | + # 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 + + - name: install ci-dependencies + run: make ci-dependencies + + - name: setup tests + run: ./tests/ci/setup.sh + + - name: dokku cleanup:skip + run: echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup + + - name: test docker deploys + run: | + ./tests/ci/setup.sh docker + DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker + + go-tests: + env: + GITHUB_NODE_INDEX: ${{ matrix.compiler }} + name: ci.${{ matrix.index }} + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + index: [0, 1, 2, 3, 4] steps: - uses: actions/checkout@v2 @@ -70,25 +150,8 @@ jobs: 2) sudo -E make -e deploy-test-multi ;; 3) sudo -E make -e deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;; esac - - name: run ci - shell: bash - timeout-minutes: 60 - run: | - sudo -E make -e test-ci - - - name: test docker deploys - run: | - if [ "${GITHUB_NODE_INDEX}" == "0" ]; then - ./tests/ci/setup.sh docker - DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker - fi - uses: actions/upload-artifact@v2 with: name: coverage.${{ matrix.index }}.out path: coverage.out - - - uses: actions/upload-artifact@v2 - with: - name: test-results-${{ matrix.index }} - path: test-results diff --git a/tests.mk b/tests.mk index 1d16ef943..df18116da 100644 --- a/tests.mk +++ b/tests.mk @@ -267,4 +267,30 @@ test-ci: @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; circleci tests glob *.bats | circleci tests split --split-by=timings --timings-type=classname | xargs)" cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; circleci tests glob *.bats | circleci tests split --split-by=timings --timings-type=classname | xargs) +test-ci-0: + @mkdir -p test-results/bats + @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; ls *.bats | xargs)" + cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; ls 10*.bats | xargs) + +test-ci-1: + @mkdir -p test-results/bats + @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; ls *.bats | xargs)" + cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; ls 20*.bats | xargs) + +test-ci-2: + @mkdir -p test-results/bats + @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; ls *.bats | xargs)" + cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; ls 30*.bats | xargs) + +test-ci-3: + @mkdir -p test-results/bats + @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; ls *.bats | xargs)" + cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; ls 40*.bats | xargs) + +test-ci-4: + @mkdir -p test-results/bats + @cd tests/unit && echo "executing tests: $(shell cd tests/unit ; ls *.bats | xargs)" + cd tests/unit && bats --formatter bats-format-junit -e -T -o ../../test-results/bats $(shell cd tests/unit ; ls 50*.bats | xargs) + + test-ci-docker: setup-docker-deploy-tests deploy-test-checks-root deploy-test-config deploy-test-multi deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy