Skip to content

chore: Running integration tests in release workflow #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/resources/integ-service-account.json.gpg
Binary file not shown.
11 changes: 11 additions & 0 deletions .github/scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e
set -u

gpg --quiet --batch --yes --decrypt --passphrase="${FIREBASE_SERVICE_ACCT_KEY}" \
--output integ-service-account.json .github/resources/integ-service-account.json.gpg

echo "${FIREBASE_API_KEY}" > integ-api-key.txt

pytest integration/ --cert integ-service-account.json --apikey integ-api-key.txt
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Continuous Integration

on: [push, pull_request]
on: push

jobs:
build:
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@
name: Release

on:
# Only run the workflow when a PR is closed, or when a developer explicitly requests
# Only run the workflow when a PR is updated or when a developer explicitly requests
# a build by sending a 'firebase_build' event.
pull_request:
types:
- closed
types: [opened, synchronize, closed]

repository_dispatch:
types:
- firebase_build

jobs:
stage_release:
# If triggered by a PR it must be merged and contain the label 'release:build'.
# If triggered by a PR it must contain the label 'release:build'.
if: github.event.action == 'firebase_build' ||
(github.event.pull_request.merged &&
contains(github.event.pull_request.labels.*.name, 'release:build'))
contains(github.event.pull_request.labels.*.name, 'release:build')

runs-on: ubuntu-latest

Expand All @@ -53,10 +51,14 @@ jobs:
pip install -r requirements.txt
pip install wheel

- name: Run tests
run: |
pytest
echo "Running integration tests"
- name: Run unit tests
run: pytest

- name: Run integration tests
run: ./.github/scripts/run_integration_tests.sh
env:
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}

- name: Package release artifacts
run: python setup.py bdist_wheel bdist_egg
Expand Down
2 changes: 1 addition & 1 deletion integration/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def update_rules(app):
with open(testutils.resource_filename('dinosaurs_index.json')) as rules_file:
new_rules = json.load(rules_file)
client = db.reference('', app)._client
rules = client.body('get', '/.settings/rules.json')
rules = client.body('get', '/.settings/rules.json', params='format=strict')
existing = rules.get('rules')
if existing != new_rules:
rules['rules'] = new_rules
Expand Down