Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredEzz authored Jan 29, 2025
2 parents f92120d + dcd8b9e commit d4119ed
Show file tree
Hide file tree
Showing 44 changed files with 2,186 additions and 505 deletions.
Binary file modified .github/resources/firebase.asc.gpg
Binary file not shown.
Binary file modified .github/resources/integ-service-account.json.gpg
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>77A3CB7D41F06A4512BA8EA5AA4E6ADF6A05C58E</gpg.keyname>
<gpg.keyname>0A05D8FAD4287A36C53BE07714D6B82AEB1DD39C</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
Expand Down
13 changes: 7 additions & 6 deletions .github/scripts/publish_preflight_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [[ ! "${RELEASE_VERSION}" =~ ^([0-9]*)\.([0-9]*)\.([0-9]*)$ ]]; then
fi

echo_info "Extracted release version: ${RELEASE_VERSION}"
echo "::set-output name=version::v${RELEASE_VERSION}"
echo "version=v${RELEASE_VERSION}" >> $GITHUB_OUTPUT


echo_info ""
Expand Down Expand Up @@ -132,12 +132,13 @@ readonly CHANGELOG=`${CURRENT_DIR}/generate_changelog.sh`
echo "$CHANGELOG"

# Parse and preformat the text to handle multi-line output.
# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
# and https://github.com/github/docs/issues/21529#issue-1418590935
FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"`
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}"
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}"
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=changelog::${FILTERED_CHANGELOG}"
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\''/'"'}"
echo "changelog<<CHANGELOGEOF" >> $GITHUB_OUTPUT
echo -e "$FILTERED_CHANGELOG" >> $GITHUB_OUTPUT
echo "CHANGELOGEOF" >> $GITHUB_OUTPUT


echo ""
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ jobs:
java-version: [8, 11, 17]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}

# Does the following:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ jobs:

steps:
- name: Checkout source for staging
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'zulu'
java-version: 8

- name: Compile, test and package
run: ./.github/scripts/package_artifacts.sh
Expand All @@ -47,7 +48,7 @@ jobs:
# Attach the packaged artifacts to the workflow output. These can be manually
# downloaded for later inspection if necessary.
- name: Archive artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand Down
36 changes: 16 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ jobs:
# via the 'ref' client parameter.
steps:
- name: Checkout source for staging
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'zulu'
java-version: 8

- name: Compile, test and package
run: ./.github/scripts/package_artifacts.sh
Expand All @@ -58,7 +59,7 @@ jobs:
# Attach the packaged artifacts to the workflow output. These can be manually
# downloaded for later inspection if necessary.
- name: Archive artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -72,20 +73,21 @@ jobs:
# 3. with the label 'release:publish', and
# 4. the title prefix '[chore] Release '.
if: github.event.pull_request.merged &&
github.ref == 'master' &&
github.ref == 'refs/heads/master' &&
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
startsWith(github.event.pull_request.title, '[chore] Release ')

runs-on: ubuntu-latest

steps:
- name: Checkout source for publish
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'zulu'
java-version: 8

- name: Publish preflight check
id: preflight
Expand All @@ -99,19 +101,13 @@ jobs:
NEXUS_OSSRH_USERNAME: ${{ secrets.NEXUS_OSSRH_USERNAME }}
NEXUS_OSSRH_PASSWORD: ${{ secrets.NEXUS_OSSRH_PASSWORD }}

# We pull this action from a custom fork of a contributor until
# https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of
# this action does not support the "body" parameter.
# See: https://cli.github.com/manual/gh_release_create
- name: Create release tag
uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.preflight.outputs.version }}
release_name: Firebase Admin Java SDK ${{ steps.preflight.outputs.version }}
body: ${{ steps.preflight.outputs.changelog }}
draft: false
prerelease: false
run: gh release create ${{ steps.preflight.outputs.version }}
--title "Firebase Admin Java SDK ${{ steps.preflight.outputs.version }}"
--notes '${{ steps.preflight.outputs.changelog }}'

# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
- name: Post to Twitter
Expand Down
105 changes: 84 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,90 @@ mvn test
Integration tests are also written using Junit4. They coexist with the unit tests in the `src/test`
subdirectory. Integration tests follow the naming convention `*IT.java` (e.g. `DataTestIT.java`),
which enables the Maven Surefire and Failsafe plugins to differentiate between the two types of
tests. Integration tests are executed against a real life Firebase project, and therefore
requires an Internet connection.

Create a new project in the [Firebase console](https://console.firebase.google.com/) if you do
not already have one. Use a separate, dedicated project for integration tests since the test suite
makes a large number of writes to the Firebase realtime database. Download the service account
private key from the "Settings > Service Accounts" page of the project, and save it as
`integration_cert.json` at the root of the codebase. Grant your service account the `Firebase
Authentication Admin` role at
[Google Cloud Platform Console / IAM & admin](https://console.cloud.google.com/iam-admin). This is
required to ensure that exported user records contain the password hashes of the user accounts.
Also obtain the web API key of the project from the "Settings > General" page, and save it as
`integration_apikey.txt` at the root of the codebase.

Some of the integration tests require an
[Identity Platform](https://cloud.google.com/identity-platform/) project with multi-tenancy
[enabled](https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy).
An existing Firebase project can be upgraded to an Identity Platform project without losing any
functionality via the
[Identity Platform Marketplace Page](https://console.cloud.google.com/customer-identity). Note that
charges may be incurred for active users beyond the Identity Platform free tier.
tests.

Integration tests are executed against a real life Firebase project. If you do not already
have one suitable for running the tests against, you can create a new project in the
[Firebase Console](https://console.firebase.google.com) following the setup guide below.
If you already have a Firebase project, you'll need to obtain credentials to communicate and
authorize access to your Firebase project:

1. Service account certificate: This allows access to your Firebase project through a service account
which is required for all integration tests. This can be downloaded as a JSON file from the
**Settings > Service Accounts** tab of the Firebase console when you click the
**Generate new private key** button. Copy the file into the repo so it's available at
`integration_cert.json`.
> **Note:** Service accounts should be carefully managed and their keys should never be stored in publicly accessible source code or repositories.

2. Web API key: This allows for Auth sign-in needed for some Authentication and Tenant Management
integration tests. This is displayed in the **Settings > General** tab of the Firebase console
after enabling Authentication as described in the steps below. Copy it and save to a new text
file at `integration_apikey.txt`.


Set up your Firebase project as follows:


1. Enable Authentication:
1. Go to the Firebase Console, and select **Authentication** from the **Build** menu.
2. Click on **Get Started**.
3. Select **Sign-in method > Add new provider > Email/Password** then enable both the
**Email/Password** and **Email link (passwordless sign-in)** options.


2. Enable Firestore:
1. Go to the Firebase Console, and select **Firestore Database** from the **Build** menu.
2. Click on the **Create database** button. You can choose to set up Firestore either in
the production mode or in the test mode.


3. Enable Realtime Database:
1. Go to the Firebase Console, and select **Realtime Database** from the **Build** menu.
2. Click on the **Create Database** button. You can choose to set up the Realtime Database
either in the locked mode or in the test mode.

> **Note:** Integration tests are not run against the default Realtime Database reference and are
instead run against a database created at `https://{PROJECT_ID}.firebaseio.com`.
This second Realtime Database reference is created in the following steps.

3. In the **Data** tab click on the kebab menu (3 dots) and select **Create Database**.
4. Enter your Project ID (Found in the **General** tab in **Account Settings**) as the
**Realtime Database reference**. Again, you can choose to set up the Realtime Database
either in the locked mode or in the test mode.


4. Enable Storage:
1. Go to the Firebase Console, and select **Storage** from the **Build** menu.
2. Click on the **Get started** button. You can choose to set up Cloud Storage
either in the production mode or in the test mode.


5. Enable the IAM API:
1. Go to the [Google Cloud console](https://console.cloud.google.com)
and make sure your Firebase project is selected.
2. Select **APIs & Services** from the main menu, and click the
**ENABLE APIS AND SERVICES** button.
3. Search for and enable **Identity and Access Management (IAM) API** by Google Enterprise API.


6. Enable Tenant Management:
1. Go to
[Google Cloud console | Identity Platform](https://console.cloud.google.com/customer-identity/)
and if it is not already enabled, click **Enable**.
2. Then
[enable multi-tenancy](https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy)
for your project.


7. Ensure your service account has the **Firebase Authentication Admin** role. This is required
to ensure that exported user records contain the password hashes of the user accounts:
1. Go to [Google Cloud console | IAM & admin](https://console.cloud.google.com/iam-admin).
2. Find your service account in the list. If not added click the pencil icon to edit its
permissions.
3. Click **ADD ANOTHER ROLE** and choose **Firebase Authentication Admin**.
4. Click **SAVE**.


Now run the following command to invoke the integration test suite:

Expand Down
Loading

0 comments on commit d4119ed

Please sign in to comment.