Skip to content

Commit

Permalink
TEMP: Only run docker test. And for multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
roekatz committed Jul 17, 2024
1 parent ebc2931 commit 9a62e33
Showing 1 changed file with 132 additions and 37 deletions.
169 changes: 132 additions & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,43 @@ on:
workflow_dispatch:

jobs:
build:
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f ./tests/requirements.txt ]; then pip install -r ./tests/requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
# build:
# services:
# redis:
# image: redis
# ports:
# - 6379:6379
# options: >-
# --health-cmd "redis-cli ping"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.9", "3.10", "3.11", "3.12"]
#
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install flake8
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# if [ -f ./tests/requirements.txt ]; then pip install -r ./tests/requirements.txt; fi
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# run: |
# pytest

test-docker:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -109,3 +109,98 @@ jobs:
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs

- name: check if opal-client was brought up
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs

- name: check if opal-client was brought up
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs

- name: check if opal-client was brought up
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs

- name: check if opal-client was brought up
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"
# TEST PHASE
- name: Create modified docker compose file
run: sed 's/:latest/:test/g' docker/docker-compose-with-callbacks.yml > docker/docker-compose-test.yml

- name: Bring up stack
run: docker-compose -f docker/docker-compose-test.yml up -d

- name: Check if OPA is healthy
run: ./scripts/wait-for.sh -t 2 http://localhost:8181/v1/data/users -- sleep 10 && curl -s "http://localhost:8181/v1/data/users" | jq '.result.bob.location.country == "US"'

- name: Output container logs
run: docker-compose -f docker/docker-compose-test.yml logs

- name: check if opal-client was brought up
run: |
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Connected to PubSub server"
docker-compose -f docker/docker-compose-test.yml logs opal_client | grep "Got policy bundle"

0 comments on commit 9a62e33

Please sign in to comment.