Integration tests (#5) #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: antonengelhardt/rust-docker-tools | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cargo Deny | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
- name: Run Rust tests | |
run: | | |
rustc --version && cargo --version | |
cargo clippy | |
cargo test --workspace --verbose | |
integration-test: | |
runs-on: ubuntu-latest | |
container: | |
image: antonengelhardt/rust-docker-tools | |
services: | |
envoy: | |
image: envoyproxy/envoy:v1.24-latest | |
ports: | |
- "10000:10000" | |
volumes: | |
- ./envoy.yaml:/etc/envoy/envoy.yaml | |
- ../target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins | |
options: envoy -c /etc/envoy/envoy.yaml --concurrency 1 | |
httpbin: | |
image: kennethreitz/httpbin | |
ports: | |
- "80:80" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Create .env for Integration tests | |
run: | | |
echo "CI=true" >> integration-tests/.env | |
echo "WASM_OIDC_PLUGIN_TEST_EMAIL={{ secrets.WASM_OIDC_PLUGIN_TEST_EMAIL }}" >> integration-tests/.env | |
echo "WASM_OIDC_PLUGIN_TEST_PASSWORD={{ secrets.WASM_OIDC_PLUGIN_TEST_PASSWORD }}" >> integration-tests/.env | |
sed -i 's/client_secret: \"redacted\"/client_secret: \"${{ secrets.WASM_OIDC_PLUGIN_TEST_CLIENT_SECRET }}\"/g' integration-tests/envoy.yaml | |
- name: Install Chrome, Chromedriver, Docker, Docker-Compose and Python (and pip) | |
run: | | |
apk update | |
apk add chromium | |
apk add chromium-chromedriver | |
apk add docker | |
apk add docker-compose | |
apk add python3 | |
apk add py3-pip | |
- name: Install Requirements | |
run: | | |
pip install -r integration-tests/requirements.txt | |
- name: Build WASM OIDC Plugin | |
run: | | |
cargo build --target wasm32-wasi --release | |
- name: Run Integration tests | |
run: | | |
chromium-browser | |
chromedriver --silent | |
pytest test.py |