Skip to content

Commit

Permalink
🔖 Bump to version 7.0.0 (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliy-pavlenko authored Aug 1, 2024
1 parent 5758799 commit 8295b00
Show file tree
Hide file tree
Showing 24 changed files with 276 additions and 75 deletions.
111 changes: 56 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ jobs:
**/TEST-*.xml
android-tests:
runs-on: macos-11
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -109,6 +110,12 @@ jobs:
with:
ref: ${{ github.event.inputs.git-ref }}

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Java 11
uses: actions/setup-java@v3
with:
Expand All @@ -122,21 +129,14 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Disable TCP/UDP Offloading (macOS)
shell: bash
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
- name: Run all Android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
target: ${{ matrix.tag }}
arch: ${{ matrix.abi }}
force-avd-creation: false
# Use a medium size skin rather than default size. Some tests need to have a decent size.
emulator-options: -no-snapshot-save -noaudio -no-boot-anim -skin 360x640
emulator-options: -no-window -no-snapshot-save -noaudio -no-boot-anim -skin 360x640
disable-animations: true
script: |
adb logcat -c # clear logs
Expand Down Expand Up @@ -175,52 +175,53 @@ jobs:
**/TEST-*.xml
**/test-results/gordon/*.xml
quality-tests:
runs-on: ubuntu-latest

needs:
- java-tests
- android-tests

steps:
- name: Checkout (latest)
uses: actions/checkout@v3
if: github.event.inputs.git-ref == ''
with:
# Fetch the whole history to activate the auto-assignment of Sonar issues.
# Also, Sonar needs the base branch to be fetched in order to provide a good report.
fetch-depth: 0

- name: Checkout (custom ref)
uses: actions/checkout@v3
if: github.event.inputs.git-ref != ''
with:
fetch-depth: 0 # Same as above
ref: ${{ github.event.inputs.git-ref }}

# Sonar drops support of Java 8 in favor of the new LTS: Java 11.
# See https://sonarcloud.io/documentation/user-guide/move-analysis-java-11/
- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Download quality reports of java-tests
uses: actions/download-artifact@v3
with:
name: java-quality-reports

- name: Download quality reports of android-tests
uses: actions/download-artifact@v3
with:
name: android-quality-reports

- name: SonarQube Analysis
run: ./gradlew sonarqube
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# @TODO: sonarqube doesn't work with Java 11, it needs 17 version as minimum, but the project doesn't build when using Java 17 (there are Kapt errors, which needed to be fixed)
# quality-tests:
# runs-on: ubuntu-latest
#
# needs:
# - java-tests
# - android-tests
#
# steps:
# - name: Checkout (latest)
# uses: actions/checkout@v3
# if: github.event.inputs.git-ref == ''
# with:
# # Fetch the whole history to activate the auto-assignment of Sonar issues.
# # Also, Sonar needs the base branch to be fetched in order to provide a good report.
# fetch-depth: 0
#
# - name: Checkout (custom ref)
# uses: actions/checkout@v3
# if: github.event.inputs.git-ref != ''
# with:
# fetch-depth: 0 # Same as above
# ref: ${{ github.event.inputs.git-ref }}
#
# # Sonar drops support of Java 11 in favor of the Java 17.
# # See https://docs.sonarsource.com/sonarcloud/appendices/announcements/#january-15-end-of-support-for-java-11
# - name: Setup Java 17
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'
#
# - name: Download quality reports of java-tests
# uses: actions/download-artifact@v3
# with:
# name: java-quality-reports
#
# - name: Download quality reports of android-tests
# uses: actions/download-artifact@v3
# with:
# name: android-quality-reports
#
# - name: SonarQube Analysis
# run: ./gradlew sonarqube
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy-development-artifacts:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Next Version

# Version 7.0.0
- Add inventoryGroupId parameter

# Version 6.0.0
- Add support of Android 14 (API level 34)
- Add support for MRAID 2.0 specification
Expand Down
11 changes: 3 additions & 8 deletions app/src/main/java/com/criteo/testapp/AdMobMediationActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,9 @@ import java.security.MessageDigest
class AdMobMediationActivity : AppCompatActivity() {

private companion object {
/** This AdMob AdUnit is mapped to this Criteo AdUnit: /140800857/Endeavour_320x50 */
const val ADMOB_BANNER = "ca-app-pub-8459323526901202/2832836926"

/** This AdMob AdUnit is mapped to this Criteo AdUnit: /140800857/Endeavour_320x480 */
const val ADMOB_INTERSTITIAL = "ca-app-pub-8459323526901202/6462812944"

/** This AdMob AdUnit is mapped to this Criteo AdUnit: /140800857/Endeavour_Native */
const val ADMOB_NATIVE = "ca-app-pub-8459323526901202/2863808899"
const val ADMOB_BANNER = "ca-app-pub-3940256099942544/9214589741"
const val ADMOB_INTERSTITIAL = "ca-app-pub-3940256099942544/1033173712"
const val ADMOB_NATIVE = "ca-app-pub-3940256099942544/2247696110"
}

private val tag = javaClass.simpleName
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/criteo/testapp/DfpActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
public class DfpActivity extends AppCompatActivity {

private static final String TAG = DfpActivity.class.getSimpleName();
private static final String DFP_INTERSTITIAL_AD_UNIT_ID = "/140800857/Endeavour_Interstitial_320x480";
private static final String DFP_BANNER_AD_UNIT_ID = "/140800857/Endeavour_320x50";
private static final String DFP_NATIVE_AD_UNIT_ID = "/140800857/Endeavour_Native";
private static final String DFP_INTERSTITIAL_VIDEO_ID = INTERSTITIAL_VIDEO.getAdUnitId();
private static final String DFP_REWARDED_VIDEO_ID = DFP_INTERSTITIAL_VIDEO_ID; // TODO?
private static final String DFP_INTERSTITIAL_AD_UNIT_ID = "/21775744923/example/interstitial";
private static final String DFP_BANNER_AD_UNIT_ID = "/6499/example/banner";
private static final String DFP_NATIVE_AD_UNIT_ID = "/6499/example/native";
private static final String DFP_INTERSTITIAL_VIDEO_ID = "/21775744923/example/rewarded-interstitial";
private static final String DFP_REWARDED_VIDEO_ID = "/21775744923/example/rewarded";

private LinearLayout linearLayout;
private Criteo criteo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class PubSdkDemoApplication : MultiDexApplication() {

val builder = Criteo.Builder(this, "B-000000")
.adUnits(adUnits)
.inventoryGroupId("myInventoryGroupId")

if ("release" == BuildConfig.BUILD_TYPE) {
// Enable debug logs only on release build.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_in_house.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
android:layout_height="match_parent"
app:criteoAdUnitHeight="50"
app:criteoAdUnitWidth="320"
app:criteoAdUnitId="/140800857/Endeavour_320x50"
app:criteoAdUnitId="/6499/example/banner"
app:layout_constraintStart_toStartOf="parent"
/>
<FrameLayout
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/SdkVersion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.gradle.api.Project
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

private const val sdkBaseVersion = "6.0.0"
private const val sdkBaseVersion = "7.0.0"

private val timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd.HHmm"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ private void callingCdb_GivenAdUnitAndGlobalInformation_ShouldCallCdbWithExpecte
Publisher expectedPublisher = new Publisher(
"bundle.id",
CriteoUtil.TEST_CP_ID,
CriteoUtil.TEST_INVENTORY_GROUP_ID,
new HashMap<>()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.view.ViewGroup
import android.webkit.JavascriptInterface
import android.webkit.WebView
import androidx.test.filters.FlakyTest
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import com.criteo.publisher.CriteoBannerView
import com.criteo.publisher.CriteoUtil
Expand Down Expand Up @@ -128,6 +129,7 @@ class MraidBannerFunctionalTest {
}

@Test
@LargeTest
@FlakyTest(detail = "Flakiness comes from UI and concurrency")
fun whenExpandAndThenClose_ShouldMoveBackToOriginalContainer() {
val originalLayoutParams = getWebView().layoutParams
Expand Down
9 changes: 9 additions & 0 deletions publisher-sdk/src/main/java/com/criteo/publisher/Criteo.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public static class Builder {
@Nullable
private Boolean tagForChildDirectedTreatment = null;

@Nullable
private String inventoryGroupId = null;

public Builder(@NonNull Application application, @NonNull String criteoPublisherId) {
this.application = application;
this.criteoPublisherId = criteoPublisherId;
Expand Down Expand Up @@ -105,6 +108,11 @@ public Builder tagForChildDirectedTreatment(@Nullable Boolean tagForChildDirecte
return this;
}

public Builder inventoryGroupId(@Nullable String inventoryGroupId) {
this.inventoryGroupId = inventoryGroupId;
return this;
}

public Criteo init() throws CriteoInitException {
return Criteo.init(this);
}
Expand All @@ -119,6 +127,7 @@ private static Criteo init(@NonNull Builder builder) throws CriteoInitException
DependencyProvider dependencyProvider = DependencyProvider.getInstance();
dependencyProvider.setApplication(builder.application);
dependencyProvider.setCriteoPublisherId(builder.criteoPublisherId);
dependencyProvider.setInventoryGroupId(builder.inventoryGroupId);

if (builder.isDebugLogsEnabled) {
dependencyProvider.provideConsoleHandler().setMinLogLevel(Log.INFO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class DependencyProvider {

private Application application;
private String criteoPublisherId;
private String inventoryGroupId;

protected DependencyProvider() {
}
Expand Down Expand Up @@ -169,6 +170,10 @@ public void setCriteoPublisherId(@NonNull String criteoPublisherId) {
checkCriteoPublisherIdIsSet();
}

public void setInventoryGroupId(@Nullable String inventoryGroupId) {
this.inventoryGroupId = inventoryGroupId;
}

boolean isApplicationSet() {
try {
DependencyProvider.getInstance().checkApplicationIsSet();
Expand Down Expand Up @@ -207,6 +212,11 @@ public String provideCriteoPublisherId() {
return criteoPublisherId;
}

@Nullable
public String provideInventoryGroupId() {
return inventoryGroupId;
}

@NonNull
public PubSdkApi providePubSdkApi() {
return getOrCreate(PubSdkApi.class, () -> new PubSdkApi(
Expand Down Expand Up @@ -351,6 +361,7 @@ public CdbRequestFactory provideCdbRequestFactory() {
return getOrCreate(CdbRequestFactory.class, () -> new CdbRequestFactory(
provideContext(),
provideCriteoPublisherId(),
provideInventoryGroupId(),
provideDeviceInfo(),
provideAdvertisingInfo(),
provideUserPrivacyUtil(),
Expand All @@ -375,6 +386,7 @@ public RemoteConfigRequestFactory provideRemoteConfigRequestFactory() {
return getOrCreate(RemoteConfigRequestFactory.class, () -> new RemoteConfigRequestFactory(
provideContext(),
provideCriteoPublisherId(),
provideInventoryGroupId(),
provideBuildConfigWrapper(),
provideIntegrationRegistry()
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class CdbRequestFactory {
@NonNull
private final String criteoPublisherId;

@Nullable
private final String inventoryGroupId;

@NonNull
private final DeviceInfo deviceInfo;

Expand Down Expand Up @@ -79,6 +82,7 @@ public class CdbRequestFactory {
public CdbRequestFactory(
@NonNull Context context,
@NonNull String criteoPublisherId,
@Nullable String inventoryGroupId,
@NonNull DeviceInfo deviceInfo,
@NonNull AdvertisingInfo advertisingInfo,
@NonNull UserPrivacyUtil userPrivacyUtil,
Expand All @@ -91,6 +95,7 @@ public CdbRequestFactory(
) {
this.context = context;
this.criteoPublisherId = criteoPublisherId;
this.inventoryGroupId = inventoryGroupId;
this.deviceInfo = deviceInfo;
this.advertisingInfo = advertisingInfo;
this.userPrivacyUtil = userPrivacyUtil;
Expand All @@ -112,6 +117,7 @@ public CdbRequest createRequest(
Publisher publisher = new Publisher(
context.getPackageName(),
criteoPublisherId,
inventoryGroupId,
publisherExt
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ data class Publisher(
val bundleId: String,
@Json(name = "cpId")
val criteoPublisherId: String,
@Json(name = "inventoryGroupId")
val inventoryGroupId: String?,
@Json(name = "ext")
val ext: Map<String, Any>
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import com.squareup.moshi.JsonClass
data class RemoteConfigRequest @JvmOverloads constructor(
@Json(name = "cpId")
val criteoPublisherId: String,
@Json(name = "inventoryGroupId")
val inventoryGroupId: String?,
@Json(name = "bundleId")
val bundleId: String,
@Json(name = "sdkVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ import com.criteo.publisher.util.BuildConfigWrapper
class RemoteConfigRequestFactory(
private val context: Context,
private val criteoPublisherId: String,
private val inventoryGroupId: String?,
private val buildConfigWrapper: BuildConfigWrapper,
private val integrationRegistry: IntegrationRegistry
private val integrationRegistry: IntegrationRegistry,
) {
fun createRequest(): RemoteConfigRequest {
return RemoteConfigRequest(
criteoPublisherId,
inventoryGroupId,
context.packageName,
buildConfigWrapper.sdkVersion,
integrationRegistry.profileId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ public void provideMraidController_WhenMraidEnabledIsTrueAndMraid2EnabledIsTrueA
});
}

@Test
public void setInventoryGroupId_GivenNullIsOk() {
dependencyProvider = DependencyProvider.getInstance();
dependencyProvider.setInventoryGroupId(null);
}

private void givenMraidIsEnabledEquals(Boolean isMraidEnabled, Boolean isMraid2Enabled, Function<DependencyProvider, Void> providing) {
DependencyProvider instance = spy(DependencyProvider.getInstance());
instance.setApplication(ApplicationMock.newMock());
Expand Down
Loading

0 comments on commit 8295b00

Please sign in to comment.