Skip to content
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
109 changes: 73 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,90 @@ jobs:
name: 🧪 Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install package manager (from package.json)
run: |
corepack enable
corepack install

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: 'yarn'
- name: install dependencies
run: yarn && yarn --cwd ./functions

- name: Install deps
run: yarn install --immutable

- name: run linter
run: yarn lint && yarn --cwd ./functions lint
run: yarn lint && yarn workspace functions lint

- name: run tests
run: yarn test && yarn --cwd ./functions test
# - name: Upload test results
# uses: actions/upload-artifact@v1
# with:
# name: Test results
# path: "**/artifacs"
run: yarn test && yarn workspace functions test

build:
name: 🛠 Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install package manager (from package.json)
run: |
corepack enable
corepack install

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: 'yarn'
- name: install dependencies
run: yarn && yarn --cwd ./functions

- name: Install deps
run: yarn install --immutable

- name: build
run: yarn --cwd ./functions build
run: yarn workspace functions build

testDeploy:
name: Test Deploy
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install package manager (from package.json)
run: |
corepack enable
corepack install

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: 'yarn'
- name: install dependencies
run: yarn && yarn --cwd ./functions

- name: Install deps
run: yarn install

- name: Deploy test to Firebase
uses: w9jds/firebase-action@v13.25.0
uses: w9jds/firebase-action@v14.19.0
with:
args: deploy --only functions:testFunction
args: help ; corepack enable ; corepack install ; firebase deploy --only functions:testFunction --force
env:
GCP_SA_KEY: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNITY_CI_VERSIONS }}'

- name: Call Test Function
run: curl -f -s -S -X POST https://testfunction-wbe4ukn6tq-ey.a.run.app

- name: Cleanup Firebase Test
uses: w9jds/firebase-action@v13.25.0
uses: w9jds/firebase-action@v14.19.0
if: always()
with:
args: functions:delete testFunction --force
args: help ; corepack enable ; corepack install ; firebase functions:delete testFunction --force
env:
GCP_SA_KEY: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNITY_CI_VERSIONS }}'

Expand All @@ -76,23 +102,34 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install package manager (from package.json)
run: |
corepack enable
corepack install

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: package.json
cache: 'yarn'
- name: install dependencies
run: yarn && yarn --cwd ./functions

- name: Install deps
run: yarn install --immutable

- name: Deploy to Firebase
uses: w9jds/firebase-action@v13.25.0
uses: w9jds/firebase-action@v14.19.0
with:
args: deploy
args: help ; corepack enable ; corepack install ; firebase deploy
env:
GCP_SA_KEY: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNITY_CI_VERSIONS }}'

- name: Cleanup Firebase Test
uses: w9jds/firebase-action@v13.25.0
uses: w9jds/firebase-action@v14.19.0
if: always()
with:
args: functions:delete testFunction --force
args: help ; corepack enable ; corepack install ; firebase functions:delete testFunction --force
env:
GCP_SA_KEY: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNITY_CI_VERSIONS }}'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ node_modules/
.idea
.vs
.vscode

# Yarn
functions/.yarn/
.yarn/
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ The Ingeminator ("repeater") handles the reliability of the build system:
## Database Backup

Back up the Firestore database:

```bash
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/serviceAccountKey.json"
yarn run backfire export ./export/versioningBackendBackup --project unity-ci-versions --keyFile $GOOGLE_APPLICATION_CREDENTIALS
```

Restore a backup:

```bash
yarn run backfire import ./export/versioningBackendBackup --project unity-ci-versions --keyFile $GOOGLE_APPLICATION_CREDENTIALS
```
Expand Down
13 changes: 5 additions & 8 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
"indexes": "firestore.indexes.json"
},
"functions": {
"runtime": "nodejs22",
"predeploy": [
"yarn --cwd \"$RESOURCE_DIR\" lint",
"yarn --cwd \"$RESOURCE_DIR\" test",
"yarn --cwd \"$RESOURCE_DIR\" build"
"yarn workspace functions lint",
"yarn workspace functions test",
"yarn workspace functions build"
]
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
},
"storage": {
"rules": "storage.rules"
Expand Down
12 changes: 6 additions & 6 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "echo \"No tests yet, feel free to add\" && exit 0"
},
"engines": {
"node": "20"
"node": "22"
},
"main": "lib/index.js",
"dependencies": {
Expand All @@ -21,11 +21,10 @@
"eris": "^0.17.2",
"firebase-admin": "^12.7.0",
"firebase-functions": "^6.1.0",
"graphql": "^16.9.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"semver": "^7.6.3",
"unity-changeset": "^2.5.0"
"unity-changeset": "^3.0.1"
},
"devDependencies": {
"@octokit/types": "^13.5.0",
Expand All @@ -44,7 +43,8 @@
},
"private": true,
"volta": {
"node": "20.14.0",
"yarn": "1.22.22"
}
"node": "22.20.0",
"yarn": "4.10.3"
},
"packageManager": "[email protected]"
}
Loading