diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..28504528 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,75 @@ +name: Integration tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + integration-test: + name: Run integration tests + runs-on: goth + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure python + uses: actions/setup-python@v2 + with: + python-version: '3.8.0' + + - name: Configure poetry + uses: Gr1N/setup-poetry@v4 + with: + poetry-version: 1.1.4 + + - name: Install dependencies + run: poetry install + + - name: Disconnect Docker containers from default network + continue-on-error: true + # related to this issue: https://github.com/moby/moby/issues/23302 + run: | + docker network inspect docker_default + sudo apt-get install -y jq + docker network inspect docker_default | jq ".[0].Containers | map(.Name)[]" | tee /dev/stderr | xargs --max-args 1 -- docker network disconnect -f docker_default + + - name: Remove Docker containers + continue-on-error: true + run: docker rm -f $(docker ps -a -q) + + - name: Restart Docker daemon + # related to this issue: https://github.com/moby/moby/issues/23302 + run: sudo systemctl restart docker + + - name: Log in to GitHub Docker repository + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin + + - name: Run unit tests + env: + GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: poetry run poe integration_test + + - name: Upload test logs + uses: actions/upload-artifact@v2 + if: always() + with: + name: goth-logs + path: /tmp/goth-tests + + # Only relevant for self-hosted runners + - name: Remove test logs + if: always() + run: rm -rf /tmp/goth-tests + + # Only relevant for self-hosted runners + - name: Remove poetry virtual env + if: always() + # Python version below should agree with the version set up by this job. + # In future we'll be able to use the `--all` flag here to remove envs for + # all Python versions (https://github.com/python-poetry/poetry/issues/3208). + run: poetry env remove python3.8 +