Skip to content
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

Release of dec 19 #171

Merged
merged 7 commits into from
Dec 19, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/pr-status-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
steps.changed-files.outputs.any_changed == 'true'
run: |
echo -e "${{ secrets.DOTENV_DEVELOPMENT }}" > .env
echo -e "\nREACT_APP_useEmulator=true" >> .env
echo -e "\nVITE_useEmulator=true" >> .env
echo -e "${{ secrets.FUNCTIONS_DOTENV_DEVELOPMENT }}" > functions/.env.development
sed -i "s;%%cypress_cloud_service_url%%;${{ secrets.CYPRESS_CLOUD_SERVICE_URL }};g" currents.config.js
cd functions && npm run use:dev
Expand All @@ -87,7 +87,7 @@ jobs:
steps.changed-files.outputs.any_changed == 'true'
run: |
echo -e "${{ secrets.DOTENV_PRODUCTION }}" > .env
echo -e "\nREACT_APP_useEmulator=true" >> .env
echo -e "\nVITE_useEmulator=true" >> .env
echo -e "${{ secrets.FUNCTIONS_DOTENV_PRODUCTION }}" > functions/.env.production
sed -i "s;%%cypress_cloud_service_url%%;${{ secrets.CYPRESS_CLOUD_SERVICE_URL }};g" currents.config.js
cd functions && npm run use:prod
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.renderWhitespace": "all",
"editor.formatOnSave": true,
Expand Down
23 changes: 15 additions & 8 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ beforeEach( () => {

} )

// Stub google analytics requests
// Stub third party requests during testing
beforeEach( () => {

cy.intercept( 'https://unpkg.com/**/*', { middleware: true }, req => {
Expand All @@ -41,13 +41,7 @@ beforeEach( () => {
// Respond with a stubbed function
req.reply( ' () => console.log( "Stubbed Rive WASM CDN" )' )

} ).as( 'jsdelivr' )


} )

// Stub rive WASM requests
beforeEach( () => {
} ).as( 'jsdelivr_stub' )

cy.intercept( 'https://www.googletagmanager.com/**/*', { middleware: true }, req => {

Expand All @@ -62,6 +56,19 @@ beforeEach( () => {

} ).as( 'google_tag_stub' )

cy.intercept( 'https://*.matomo.cloud/**/*', { middleware: true }, req => {

// Disable request caching
req.on( 'before:response', ( res ) => {
// force all API responses to not be cached
res.headers[ 'cache-control' ] = 'no-store'
} )

// Respond with a stubbed function
req.reply( ' () => console.log( "Stubbed matomo" )' )

} ).as( 'matomo_stub' )


} )

Expand Down
2 changes: 1 addition & 1 deletion functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.recalculate_available_codes = v2_oncall( recalculate_available_codes_adm

// On event registration, recalculate available codes
const { recalculate_available_codes } = require( './modules/codes' )
exports.recalculate_available_codes_on_event_registration = functions.runWith( { timeoutSeconds: 540, memory: '4GB' } ).firestore.document( `events/{eventId}` ).onCreate( ( { params } ) => recalculate_available_codes( params.eventId ) )
exports.recalculate_available_codes_on_event_registration = functions.runWith( { timeoutSeconds: 540, memory: '4GB' } ).firestore.document( `events/{eventId}` ).onCreate( ( snap, context ) => recalculate_available_codes( context.params.eventId ) )

// ///////////////////////////////
// Event data
Expand Down
1 change: 1 addition & 0 deletions functions/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "functions",
"version": "0.1.1",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "NODE_ENV=development ENVIRONMENT_LOCAL=true firebase emulators:start --only functions,firestore,pubsub | tee functions-emulator.log",
Expand Down
3 changes: 3 additions & 0 deletions functions/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Developer scripts

The scripts in this folder are convenience, scripts that are not used by the production system, and are purely for developer convenience.
42 changes: 42 additions & 0 deletions functions/scripts/lsof-visudo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#/bin/bash

# The script is designed to make lsof run without having to input a password for sudo

# Variables
visudo_folder=/etc/sudoers.d
visudo_file=${visudo_folder}/firebase_kill_emulators
tempfolder=/tmp
visudoconfig="
Cmnd_Alias LSOF = /usr/sbin/lsof -i
ALL ALL = NOPASSWD: LSOF
"

# Check if visudo file is correct, make it if not
function enable_visudo() {
echo "Checking visudo file format"
echo -e "$visudoconfig" >>$tempfolder/visudo.tmp
sudo visudo -c -f $tempfolder/visudo.tmp >/dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo "visudo file format is correct"
if ! test -d "$visudo_folder"; then
echo "Creating folder $visudo_folder"
sudo mkdir -p "$visudo_folder"
fi
echo "Copying visudo file to $visudo_file"
sudo cp $tempfolder/visudo.tmp $visudo_file
rm $tempfolder/visudo.tmp
else
echo "visudo file format is incorrect, please check the file and try again"
rm $tempfolder/visudo.tmp
exit 1
fi
echo "Setting permissions on $visudo_file"
sudo chmod 440 $visudo_file
}

# Check if visudo file exists, make it if not
if ! test -f "$visudo_file"; then
enable_visudo
else
echo "visudo file exists, doing nothing"
fi
Loading
Loading