Skip to content

Commit

Permalink
Merge branch 'main' into fix/44603
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Jul 22, 2024
2 parents beb4551 + 1e7d34b commit 163108f
Show file tree
Hide file tree
Showing 454 changed files with 11,387 additions and 7,798 deletions.
2 changes: 1 addition & 1 deletion .github/actions/composite/buildAndroidE2EAPK/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ runs:
distribution: "oracle"
java-version: "17"

- uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
- uses: ruby/setup-ruby@v1.187.0
with:
ruby-version: "2.7"
bundler-cache: true
Expand Down
13 changes: 11 additions & 2 deletions .github/scripts/createDocsRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {ValueOf} from 'type-fest';
type Article = {
href: string;
title: string;
order?: number;
};

type Section = {
Expand Down Expand Up @@ -60,11 +61,12 @@ function toTitleCase(str: string): string {
/**
* @param filename - The name of the file
*/
function getArticleObj(filename: string): Article {
function getArticleObj(filename: string, order?: number): Article {
const href = filename.replace('.md', '');
return {
href,
title: toTitleCase(href.replaceAll('-', ' ')),
order,
};
}

Expand All @@ -90,6 +92,12 @@ function pushOrCreateEntry<TKey extends HubEntriesKey>(hubs: Hub[], hub: string,
}
}

function getOrderFromArticleFrontMatter(path: string): number | undefined {
const frontmatter = fs.readFileSync(path, 'utf8').split('---')[1];
const frontmatterObject = yaml.load(frontmatter) as Record<string, unknown>;
return frontmatterObject.order as number | undefined;
}

/**
* Add articles and sections to hubs
* @param hubs - The hubs inside docs/articles/ for a platform
Expand All @@ -113,7 +121,8 @@ function createHubsWithArticles(hubs: string[], platformName: ValueOf<typeof pla

// Each subfolder will be a section containing articles
fs.readdirSync(`${docsDir}/articles/${platformName}/${hub}/${section}`).forEach((subArticle) => {
articles.push(getArticleObj(subArticle));
const order = getOrderFromArticleFrontMatter(`${docsDir}/articles/${platformName}/${hub}/${section}/${subArticle}`);
articles.push(getArticleObj(subArticle, order));
});

pushOrCreateEntry(routeHubs, hub, 'sections', {
Expand Down
133 changes: 67 additions & 66 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
java-version: '17'

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
uses: ruby/setup-ruby@v1.187.0
with:
ruby-version: '2.7'
bundler-cache: true
Expand All @@ -80,17 +80,12 @@ jobs:
- name: Set version in ENV
run: echo "VERSION_CODE=$(grep -o 'versionCode\s\+[0-9]\+' android/app/build.gradle | awk '{ print $2 }')" >> "$GITHUB_ENV"

- name: Run Fastlane beta
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane android beta
- name: Run Fastlane
run: bundle exec fastlane android ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'production' || 'beta' }}
env:
RUBYOPT: '-rostruct'
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Run Fastlane production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane android production
env:
VERSION: ${{ env.VERSION_CODE }}

- name: Archive Android sourcemaps
Expand All @@ -99,19 +94,28 @@ jobs:
name: android-sourcemap-${{ github.ref_name }}
path: android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map

- name: Upload Android version to GitHub artifacts
- name: Upload Android build to GitHub artifacts
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: app-production-release.aab
path: android/app/build/outputs/bundle/productionRelease/app-production-release.aab

- name: Upload Android version to Browser Stack
- name: Upload Android build to Browser Stack
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@./android/app/build/outputs/bundle/productionRelease/app-production-release.aab"
env:
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}

- name: Upload Android build to GitHub Release
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: |
RUN_ID="$(gh run list --workflow platformDeploy.yml --event push --branch ${{ github.event.release.tag_name }} --json databaseId --jq '.[0].databaseId')"
gh run download "$RUN_ID" --name app-production-release.aab
gh release upload ${{ github.event.release.tag_name }} app-production-release.aab
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Warn deployers if Android production deploy failed
if: ${{ failure() && fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -147,9 +151,13 @@ jobs:
env:
DEVELOPER_ID_SECRET_PASSPHRASE: ${{ secrets.DEVELOPER_ID_SECRET_PASSPHRASE }}

- name: Build production desktop app
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run desktop-build
- name: Build desktop app
run: |
if [[ ${{ env.SHOULD_DEPLOY_PRODUCTION }} == 'true' ]]; then
npm run desktop-build
else
npm run desktop-build-staging
fi
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
Expand All @@ -159,18 +167,17 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_GEOLOCATION_API_KEY: $${{ secrets.GCP_GEOLOCATION_API_KEY_PRODUCTION }}

- name: Upload desktop build to GitHub Workflow
uses: actions/upload-artifact@v4
with:
name: NewExpensify.dmg
path: desktop-build/NewExpensify.dmg

- name: Build staging desktop app
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run desktop-build-staging
- name: Upload desktop build to GitHub Release
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: gh release upload ${{ github.event.release.tag_name }} desktop-build/NewExpensify.dmg
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_GEOLOCATION_API_KEY: $${{ secrets.GCP_GEOLOCATION_API_KEY_STAGING }}
GITHUB_TOKEN: ${{ github.token }}

iOS:
name: Build and deploy iOS
Expand All @@ -191,7 +198,7 @@ jobs:
uses: ./.github/actions/composite/setupNode

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
uses: ruby/setup-ruby@v1.187.0
with:
ruby-version: '2.7'
bundler-cache: true
Expand Down Expand Up @@ -236,43 +243,45 @@ jobs:
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Set iOS version in ENV
run: echo "IOS_VERSION=$(echo '${{ github.event.release.tag_name }}' | tr '-' '.')" >> "$GITHUB_ENV"

- name: Run Fastlane
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane ios beta
run: bundle exec fastlane ios ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'production' || 'beta' }}
env:
APPLE_CONTACT_EMAIL: ${{ secrets.APPLE_CONTACT_EMAIL }}
APPLE_CONTACT_PHONE: ${{ secrets.APPLE_CONTACT_PHONE }}
APPLE_DEMO_EMAIL: ${{ secrets.APPLE_DEMO_EMAIL }}
APPLE_DEMO_PASSWORD: ${{ secrets.APPLE_DEMO_PASSWORD }}
VERSION: ${{ env.IOS_VERSION }}

- name: Archive iOS sourcemaps
uses: actions/upload-artifact@v4
with:
name: ios-sourcemap-${{ github.ref_name }}
path: main.jsbundle.map

- name: Upload iOS version to GitHub artifacts
- name: Upload iOS build to GitHub artifacts
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: New Expensify.ipa
path: /Users/runner/work/App/App/New Expensify.ipa

- name: Upload iOS version to Browser Stack
- name: Upload iOS build to Browser Stack
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@/Users/runner/work/App/App/New Expensify.ipa"
env:
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}

- name: Set iOS version in ENV
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: echo "IOS_VERSION=$(echo '${{ github.event.release.tag_name }}' | tr '-' '.')" >> "$GITHUB_ENV"

- name: Run Fastlane for App Store release
- name: Upload iOS build to GitHub Release
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane ios production
run: |
RUN_ID="$(gh run list --workflow platformDeploy.yml --event push --branch ${{ github.event.release.tag_name }} --json databaseId --jq '.[0].databaseId')"
gh run download "$RUN_ID" --name 'New Expensify.ipa'
gh release upload ${{ github.event.release.tag_name }} 'New Expensify.ipa'
env:
VERSION: ${{ env.IOS_VERSION }}
GITHUB_TOKEN: ${{ github.token }}

- name: Warn deployers if iOS production deploy failed
if: ${{ failure() && fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
Expand Down Expand Up @@ -314,41 +323,33 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Build web for production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run build

- name: Build web for staging
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run build-staging

- name: Build storybook docs for production
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run storybook-build
continue-on-error: true
- name: Build web
run: |
if [[ ${{ env.SHOULD_DEPLOY_PRODUCTION }} == 'true' ]]; then
npm run build
else
npm run build-staging
fi
- name: Build storybook docs for staging
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: npm run storybook-build-staging
- name: Build storybook docs
continue-on-error: true
run: |
if [[ ${{ env.SHOULD_DEPLOY_PRODUCTION }} == 'true' ]]; then
npm run storybook-build
else
npm run storybook-build-staging
fi
- name: Deploy production to S3
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://expensify-cash/.well-known/apple-app-site-association s3://expensify-cash/.well-known/apple-app-site-association && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://expensify-cash/.well-known/apple-app-site-association s3://expensify-cash/apple-app-site-association

- name: Deploy staging to S3
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist s3://staging-expensify-cash/ && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://staging-expensify-cash/.well-known/apple-app-site-association s3://staging-expensify-cash/.well-known/apple-app-site-association && aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE s3://staging-expensify-cash/.well-known/apple-app-site-association s3://staging-expensify-cash/apple-app-site-association

- name: Purge production Cloudflare cache
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
- name: Deploy to S3
run: |
aws s3 cp --recursive --acl public-read "$GITHUB_WORKSPACE"/dist ${{ env.S3_URL }}/
aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE ${{ env.S3_URL }}/.well-known/apple-app-site-association ${{ env.S3_URL }}/.well-known/apple-app-site-association
aws s3 cp --acl public-read --content-type 'application/json' --metadata-directive REPLACE ${{ env.S3_URL }}/.well-known/apple-app-site-association ${{env.S3_URL }}/apple-app-site-association
env:
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}
S3_URL: s3://${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && '' || 'staging-' }}expensify-cash

- name: Purge staging Cloudflare cache
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["staging.new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
- name: Purge Cloudflare cache
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && '' || 'staging.' }}new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
env:
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/preDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:

- name: Exit failed workflow
if: ${{ needs.typecheck.result == 'failure' || needs.lint.result == 'failure' || needs.test.result == 'failure' }}
run: exit 1
run: |
echo "Checks failed, exiting ~ typecheck: ${{ needs.typecheck.result }}, lint: ${{ needs.lint.result }}, test: ${{ needs.test.result }}"
exit 1
chooseDeployActions:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reassurePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
BASELINE_BRANCH=${BASELINE_BRANCH:="main"}
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
git switch "$BASELINE_BRANCH"
npm install --force
npm install --force || (rm -rf node_modules && npm install --force)
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
git switch --force --detach -
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
git checkout --ours .
npm install --force
npm install --force || (rm -rf node_modules && npm install --force)
NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
- name: Validate output.json
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
java-version: '17'

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
uses: ruby/setup-ruby@v1.187.0
with:
ruby-version: '2.7'
bundler-cache: true
Expand Down Expand Up @@ -117,6 +117,7 @@ jobs:
id: runFastlaneBetaTest
run: bundle exec fastlane android build_internal
env:
RUBYOPT: '-rostruct'
S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ad-hoc-expensify-cash
Expand Down Expand Up @@ -161,7 +162,7 @@ jobs:
run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app

- name: Setup Ruby
uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
uses: ruby/setup-ruby@v1.187.0
with:
ruby-version: '2.7'
bundler-cache: true
Expand Down
5 changes: 5 additions & 0 deletions .storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ const webpackConfig = ({config}: {config: Configuration}) => {
}),
);

config.module.rules?.push({
test: /\.lottie$/,
type: 'asset/resource',
});

return config;
};

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009000603
versionName "9.0.6-3"
versionCode 1009001002
versionName "9.0.10-2"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
Loading

0 comments on commit 163108f

Please sign in to comment.