Skip to content

Commit

Permalink
WIP: Set up workflows (#608)
Browse files Browse the repository at this point in the history
* Test workflow

* Turn off broken rules

* Restrict to rules changes

* Change to rules file

* Amend workflow
  • Loading branch information
warrensearle authored Jul 8, 2021
1 parent a253915 commit d0ee054
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: On pull request

on:
pull_request:
branches:
- develop
paths:
- 'database/firestore.rules'
push:
branches:
- develop
paths:
- 'database/firestore.rules'


jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: '10'
- run: echo "TEST"
# - run: npm ci
# - run: npm run ci:test:rules

deploy_to_develop:
if: github.event.pull_request.merged == 'true'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: '10'
- run: echo "MERGED"



# TO DO
# - [ ] trigger on pr and merge
# - [ ] if tests pass AND it's a merge event then deploy
1 change: 1 addition & 0 deletions database/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ service cloud.firestore {
//&& request.auth.token.email.lower() == email.lower();
}


function fieldHasValue(data, field, value) {
return !(field in data) || data[field] == value;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"production:deploy:functions": "firebase deploy --project=platform-production-9207d --only functions",
"production:deploy:storage-rules": "firebase deploy --project=platform-production-9207d --only storage:rules",
"production:deploy:realtime-rules": "firebase deploy --project=platform-production-9207d --only database",
"test:rules": "mocha './test/rules/**/*.spec.js' --timeout=10000",
"test:rules": "mocha './test/rules/**/1*.spec.js' --timeout=10000",
"test:functions": "mocha './test/functions/**/*.spec.js' --timeout=10000",
"test:actions": "jest test/actions",
"test:shared": "jest test/shared",
Expand Down

0 comments on commit d0ee054

Please sign in to comment.