Skip to content

Commit 8143068

Browse files
authored
chore: Running integration tests in release workflow (firebase#406)
1 parent 02c2ac2 commit 8143068

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed
1.69 KB
Binary file not shown.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -u
5+
6+
gpg --quiet --batch --yes --decrypt --passphrase="${FIREBASE_SERVICE_ACCT_KEY}" \
7+
--output integ-service-account.json .github/resources/integ-service-account.json.gpg
8+
9+
echo "${FIREBASE_API_KEY}" > integ-api-key.txt
10+
11+
pytest integration/ --cert integ-service-account.json --apikey integ-api-key.txt

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Continuous Integration
22

3-
on: [push, pull_request]
3+
on: push
44

55
jobs:
66
build:

.github/workflows/release.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,20 @@
1515
name: Release
1616

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

2423
repository_dispatch:
2524
types:
2625
- firebase_build
2726

2827
jobs:
2928
stage_release:
30-
# If triggered by a PR it must be merged and contain the label 'release:build'.
29+
# If triggered by a PR it must contain the label 'release:build'.
3130
if: github.event.action == 'firebase_build' ||
32-
(github.event.pull_request.merged &&
33-
contains(github.event.pull_request.labels.*.name, 'release:build'))
31+
contains(github.event.pull_request.labels.*.name, 'release:build')
3432

3533
runs-on: ubuntu-latest
3634

@@ -53,10 +51,14 @@ jobs:
5351
pip install -r requirements.txt
5452
pip install wheel
5553
56-
- name: Run tests
57-
run: |
58-
pytest
59-
echo "Running integration tests"
54+
- name: Run unit tests
55+
run: pytest
56+
57+
- name: Run integration tests
58+
run: ./.github/scripts/run_integration_tests.sh
59+
env:
60+
FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }}
61+
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
6062

6163
- name: Package release artifacts
6264
run: python setup.py bdist_wheel bdist_egg

integration/test_db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def update_rules(app):
5555
with open(testutils.resource_filename('dinosaurs_index.json')) as rules_file:
5656
new_rules = json.load(rules_file)
5757
client = db.reference('', app)._client
58-
rules = client.body('get', '/.settings/rules.json')
58+
rules = client.body('get', '/.settings/rules.json', params='format=strict')
5959
existing = rules.get('rules')
6060
if existing != new_rules:
6161
rules['rules'] = new_rules

0 commit comments

Comments
 (0)