Skip to content

Commit

Permalink
Fix CI caching issues and linter errors (#6232)
Browse files Browse the repository at this point in the history
* fix lint

* hehe

* iconValue can't be undefined

* add missing checkout step

* remove prefer offline bc is deprecated

* add mising env vars step

* add missing permissions

* remove extra chars

* prevent cancel in progress for linter

* remove concurrency for linting

---------

Co-authored-by: Bruno Barbieri <[email protected]>
  • Loading branch information
greg-schrammel and brunobar79 authored Oct 24, 2024
1 parent 61c9d54 commit b38351a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/macstadium-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ jobs:
# Job for linting and unit tests
linting-and-unit-tests:
runs-on: ["self-hosted"]
permissions:
contents: read
needs: install-deps
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"

- name: Set sanitized branch name
id: sanitize
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
Expand All @@ -74,6 +82,17 @@ jobs:
with:
name: yarn-cache-${{ env.SANITIZED_REF_NAME }}
path: .yarn
- name: Set up ENV vars & scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS
- name: Install dependencies
run: |
yarn install && yarn setup
- name: Check for frozen lockfile
run: ./scripts/check-lockfile.sh
Expand All @@ -93,9 +112,20 @@ jobs:
# iOS build and e2e tests
e2e-ios:
runs-on: ["self-hosted"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
timeout-minutes: 60
needs: install-deps
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"

- name: Set sanitized branch name
id: sanitize
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
Expand All @@ -104,6 +134,17 @@ jobs:
with:
name: yarn-cache-${{ env.SANITIZED_REF_NAME }}
path: .yarn
- name: Set up ENV vars & scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS
- name: Install dependencies
run: |
yarn install && yarn setup
- name: Rebuild detox cache
run: ./node_modules/.bin/detox clean-framework-cache && ./node_modules/.bin/detox build-framework-cache
Expand Down
9 changes: 9 additions & 0 deletions reset.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type NonFalsy<T> = T extends false | 0 | '' | null | undefined | 0n ? never : T;

interface Array<T> {
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): NonFalsy<S>[];
}

interface ReadonlyArray<T> {
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): NonFalsy<S>[];
}
25 changes: 7 additions & 18 deletions src/hooks/useOnAvatarPress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ETH_ADDRESS } from '@/references';
import { isZero } from '@/helpers/utilities';
import { IS_IOS } from '@/env';
import { buildRainbowUrl } from '@/utils/buildRainbowUrl';
import { MenuConfig } from '@/components/native-context-menu/contextMenu';

type UseOnAvatarPressProps = {
/** Is the avatar selection being used on the wallet or transaction screen? */
Expand Down Expand Up @@ -178,44 +179,32 @@ export default ({ screenType = 'transaction' }: UseOnAvatarPressProps = {}) => {
]
);

const avatarContextMenuConfig = {
const avatarContextMenuConfig: MenuConfig = {
menuTitle: '',
menuItems: [
isENSProfile &&
!isReadOnly &&
!isZeroETH && {
actionKey: 'editProfile',
actionTitle: lang.t('profiles.profile_avatar.edit_profile'),
icon: {
iconType: 'SYSTEM',
iconValue: ios ? 'pencil.circle' : null,
},
...(ios && { icon: { iconType: 'SYSTEM', iconValue: 'pencil.circle' } }),
},
isENSProfile && {
actionKey: 'viewProfile',
actionTitle: lang.t('profiles.profile_avatar.view_profile'),
icon: {
iconType: 'SYSTEM',
iconValue: ios ? 'person.crop.circle' : null,
},
...(ios && { icon: { iconType: 'SYSTEM', iconValue: 'person.crop.circle' } }),
},
!isENSProfile &&
!isReadOnly &&
!isZeroETH && {
actionKey: 'createProfile',
actionTitle: lang.t('profiles.profile_avatar.create_profile'),
icon: {
iconType: 'SYSTEM',
iconValue: ios ? 'person.crop.circle' : null,
},
...(ios && { icon: { iconType: 'SYSTEM', iconValue: 'person.crop.circle' } }),
},
{
actionKey: 'chooseFromLibrary',
actionTitle: lang.t('profiles.profile_avatar.choose_from_library'),
icon: {
iconType: 'SYSTEM',
iconValue: ios ? 'photo.on.rectangle.angled' : null,
},
...(ios && { icon: { iconType: 'SYSTEM', iconValue: 'photo.on.rectangle.angled' } }),
},
!accountImage
? ios
Expand All @@ -235,7 +224,7 @@ export default ({ screenType = 'transaction' }: UseOnAvatarPressProps = {}) => {
actionKey: 'removePhoto',
actionTitle: lang.t('profiles.profile_avatar.remove_photo'),
},
].filter(x => x),
].filter(Boolean),
};

const avatarActionSheetOptions = avatarContextMenuConfig.menuItems.map(item => item && item.actionTitle).concat(ios ? ['Cancel'] : []);
Expand Down
1 change: 0 additions & 1 deletion src/screens/ExchangeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ export function ExchangeModal({ fromDiscover, ignoreInitialTypeCheck, testID, ty
marginBottom={0}
marginTop={0}
testID={`${testID}-gas`}
// @ts-expect-error - invalid prop type but fixed in the next PR
crossChainServiceTime={getCrosschainSwapServiceTime(tradeDetails as CrosschainQuote)}
/>
</Row>
Expand Down

0 comments on commit b38351a

Please sign in to comment.