From 31774461e24e755749a4bd8b2ff109bd4fefcab0 Mon Sep 17 00:00:00 2001 From: Daniel Dimitrov Date: Tue, 17 Dec 2024 23:02:39 +0100 Subject: [PATCH] fix acitons --- .../build-storybook/action.yml | 0 .github/actions/build/action.yml | 13 ++++ .../{workflows => actions}/cypress/action.yml | 4 +- .github/actions/yarn/action.yml | 36 +++++++++++ .github/workflows/build/action.yml | 62 ------------------- .github/workflows/deploy-dev.yml | 6 +- .github/workflows/deploy-production.yml | 4 +- .github/workflows/e2e-full-ondemand.yml | 2 +- .github/workflows/e2e-hp-ondemand.yml | 2 +- .github/workflows/e2e-ondemand.yml | 2 +- .github/workflows/e2e-prod-ondemand.yml | 2 +- .github/workflows/e2e-safe-apps.yml | 2 +- .github/workflows/e2e-smoke.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/nextjs-bundle-analysis.yml | 4 +- .github/workflows/unit-tests.yml | 2 +- .github/workflows/yarn/action.yml | 40 ------------ 17 files changed, 66 insertions(+), 119 deletions(-) rename .github/{workflows => actions}/build-storybook/action.yml (100%) rename .github/{workflows => actions}/cypress/action.yml (95%) create mode 100644 .github/actions/yarn/action.yml delete mode 100644 .github/workflows/build/action.yml delete mode 100644 .github/workflows/yarn/action.yml diff --git a/.github/workflows/build-storybook/action.yml b/.github/actions/build-storybook/action.yml similarity index 100% rename from .github/workflows/build-storybook/action.yml rename to .github/actions/build-storybook/action.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 60bccbcb12..8d6810ab3a 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -19,6 +19,12 @@ runs: using: 'composite' steps: + - name: Restore Next.js Build Cache & Cypress cache + id: restore-nc + uses: ./.github/actions/cache-deps + with: + mode: restore-nc + - name: Set environment variables shell: bash run: | @@ -61,3 +67,10 @@ runs: NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING }} NEXT_PUBLIC_SPINDL_SDK_KEY: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SPINDL_SDK_KEY }} NEXT_PUBLIC_ECOSYSTEM_ID_ADDRESS: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_ECOSYSTEM_ID_ADDRESS }} + + - name: Save Next.js Build Cache & Cypress cache + if: steps.restore-nc.outputs.cache-hit-nc != 'true' + uses: ./.github/actions/cache-deps + with: + mode: save-nc + key: ${{ steps.restore-nc.outputs.computed-cache-key-nc }} diff --git a/.github/workflows/cypress/action.yml b/.github/actions/cypress/action.yml similarity index 95% rename from .github/workflows/cypress/action.yml rename to .github/actions/cypress/action.yml index 4a9e32a561..44d9849338 100644 --- a/.github/workflows/cypress/action.yml +++ b/.github/actions/cypress/action.yml @@ -30,7 +30,7 @@ inputs: runs: using: 'composite' steps: - - uses: ./.github/workflows/yarn + - uses: ./.github/actions/yarn - name: Install Latest stable Chrome Version shell: bash @@ -38,7 +38,7 @@ runs: curl -O 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb' sudo apt-get install ./google-chrome-stable_current_amd64.deb - - uses: ./.github/workflows/build + - uses: ./.github/actions/build with: secrets: ${{ inputs.secrets }} e2e_mnemonic: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_CYPRESS_MNEMONIC }} diff --git a/.github/actions/yarn/action.yml b/.github/actions/yarn/action.yml new file mode 100644 index 0000000000..252365aa12 --- /dev/null +++ b/.github/actions/yarn/action.yml @@ -0,0 +1,36 @@ +name: 'Yarn' + +description: 'Install the dependencies' + +runs: + using: 'composite' + steps: + # We require yarn v4 and installing through corepack is the easiest way to get it + - uses: actions/checkout@v4 + + - uses: ./.github/actions/corepack + + - name: Restore Yarn Cache & Types + id: restore-yarn-types + uses: ./.github/actions/cache-deps + with: + mode: restore-yarn + + - name: Echo cache hit + shell: bash + run: | + echo "Yarn cache hit: ${{ steps.restore-yarn-types.outputs.cache-hit-yarn }}" + + - name: Yarn install & after-install generate types + if: steps.restore-yarn-types.outputs.cache-hit-yarn != 'true' + shell: bash + run: | + yarn install --immutable + yarn after-install + + - name: Save Yarn Cache & Types + if: steps.restore-yarn-types.outputs.cache-hit-yarn != 'true' + uses: ./.github/actions/cache-deps + with: + mode: save-yarn + key: ${{ steps.restore-yarn-types.outputs.computed-cache-key-yarn }} diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml deleted file mode 100644 index ba6ad94d7e..0000000000 --- a/.github/workflows/build/action.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: 'Build' - -description: 'Build the app' - -inputs: - secrets: - required: true - - prod: # id of input - description: 'Production build flag' - required: false - - e2e_mnemonic: - description: 'Mnemonic for the E2E tests' - required: false - -runs: - using: 'composite' - - steps: - - name: Set environment variables - shell: bash - run: | - if [ "${{ inputs.prod }}" = "true" ]; then - echo "NEXT_PUBLIC_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_INFURA_TOKEN }}" >> $GITHUB_ENV - echo "NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN }}" >> $GITHUB_ENV - else - echo "NEXT_PUBLIC_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_INFURA_TOKEN_DEVSTAGING }}" >> $GITHUB_ENV - echo "NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN_DEVSTAGING }}" >> $GITHUB_ENV - fi - - - name: Build - shell: bash - run: yarn build - env: - NEXT_PUBLIC_IS_PRODUCTION: ${{ inputs.prod }} - NEXT_PUBLIC_CYPRESS_MNEMONIC: ${{ inputs.e2e_mnemonic }} - NEXT_PUBLIC_GATEWAY_URL_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GATEWAY_URL_PRODUCTION }} - NEXT_PUBLIC_GATEWAY_URL_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GATEWAY_URL_STAGING }} - NEXT_PUBLIC_SAFE_VERSION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_VERSION }} - NEXT_PUBLIC_BEAMER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_BEAMER_ID }} - NEXT_PUBLIC_GOOGLE_TAG_MANAGER_DEVELOPMENT_AUTH: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_DEVELOPMENT_AUTH }} - NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID }} - NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LATEST_AUTH: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LATEST_AUTH }} - NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LIVE_AUTH: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LIVE_AUTH }} - NEXT_PUBLIC_SENTRY_DSN: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SENTRY_DSN }} - NEXT_PUBLIC_TENDERLY_ORG_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_ORG_NAME }} - NEXT_PUBLIC_TENDERLY_PROJECT_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_PROJECT_NAME }} - NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL }} - NEXT_PUBLIC_WC_PROJECT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WC_PROJECT_ID }} - NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_PRODUCTION }} - NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_STAGING }} - NEXT_PUBLIC_IS_OFFICIAL_HOST: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_IS_OFFICIAL_HOST }} - NEXT_PUBLIC_BLOCKAID_CLIENT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_BLOCKAID_CLIENT_ID }} - NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING }} - NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION }} - NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION }} - NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING }} - NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION }} - NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING }} - NEXT_PUBLIC_SPINDL_SDK_KEY: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SPINDL_SDK_KEY }} - NEXT_PUBLIC_ECOSYSTEM_ID_ADDRESS: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_ECOSYSTEM_ID_ADDRESS }} diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index e6ef646e00..b6f00836e2 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -36,12 +36,12 @@ jobs: - uses: actions/checkout@v4 - - uses: ./.github/workflows/yarn + - uses: ./.github/actions/yarn - - uses: ./.github/workflows/build + - uses: ./.github/actions/build with: secrets: ${{ toJSON(secrets) }} - if: startsWith(github.ref, 'refs/heads/main') + # if: startsWith(github.ref, 'refs/heads/main') #- uses: ./.github/workflows/build-storybook diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 32a2f2ff64..e97d65163e 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -19,9 +19,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/yarn + - uses: ./.github/actions/yarn - - uses: ./.github/workflows/build + - uses: ./.github/actions/build with: secrets: ${{ toJSON(secrets) }} prod: ${{ true }} diff --git a/.github/workflows/e2e-full-ondemand.yml b/.github/workflows/e2e-full-ondemand.yml index bfe12b8273..e08a229e55 100644 --- a/.github/workflows/e2e-full-ondemand.yml +++ b/.github/workflows/e2e-full-ondemand.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: | diff --git a/.github/workflows/e2e-hp-ondemand.yml b/.github/workflows/e2e-hp-ondemand.yml index b30bcd8dfd..dbc1535f42 100644 --- a/.github/workflows/e2e-hp-ondemand.yml +++ b/.github/workflows/e2e-hp-ondemand.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: | diff --git a/.github/workflows/e2e-ondemand.yml b/.github/workflows/e2e-ondemand.yml index 7538f7e10b..360ab9851e 100644 --- a/.github/workflows/e2e-ondemand.yml +++ b/.github/workflows/e2e-ondemand.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: | diff --git a/.github/workflows/e2e-prod-ondemand.yml b/.github/workflows/e2e-prod-ondemand.yml index 22c9f1878c..20ed359556 100644 --- a/.github/workflows/e2e-prod-ondemand.yml +++ b/.github/workflows/e2e-prod-ondemand.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: | diff --git a/.github/workflows/e2e-safe-apps.yml b/.github/workflows/e2e-safe-apps.yml index 88c0d5d326..5ff65bb60b 100644 --- a/.github/workflows/e2e-safe-apps.yml +++ b/.github/workflows/e2e-safe-apps.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: cypress/e2e/safe-apps/*.cy.js diff --git a/.github/workflows/e2e-smoke.yml b/.github/workflows/e2e-smoke.yml index cb7abeabbb..60a861696a 100644 --- a/.github/workflows/e2e-smoke.yml +++ b/.github/workflows/e2e-smoke.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/cypress + - uses: ./.github/actions/cypress with: secrets: ${{ toJSON(secrets) }} spec: cypress/e2e/smoke/*.cy.js diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0bb639e056..c54133e13a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/yarn + - uses: ./.github/actions/yarn - uses: CatChen/eslint-suggestion-action@v4.1.7 with: diff --git a/.github/workflows/nextjs-bundle-analysis.yml b/.github/workflows/nextjs-bundle-analysis.yml index 49d08b0097..c61a7e776d 100644 --- a/.github/workflows/nextjs-bundle-analysis.yml +++ b/.github/workflows/nextjs-bundle-analysis.yml @@ -21,10 +21,10 @@ jobs: - uses: actions/checkout@v4 - name: Install dependencies - uses: ./.github/workflows/yarn + uses: ./.github/actions/yarn - name: Build next.js app - uses: ./.github/workflows/build + uses: ./.github/actions/build with: secrets: ${{ toJSON(secrets) }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 54aed48787..7bdd552476 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/workflows/yarn + - uses: ./.github/actions/yarn - name: Annotations and coverage report uses: ArtiomTr/jest-coverage-report-action@v2.3.1 diff --git a/.github/workflows/yarn/action.yml b/.github/workflows/yarn/action.yml deleted file mode 100644 index 097cafe88d..0000000000 --- a/.github/workflows/yarn/action.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: 'Yarn' - -description: 'Install the dependencies' - -runs: - using: 'composite' - steps: - # We require yarn v4 and installing through corepack is the easiest way to get it - - name: Enable Corepack - shell: bash - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: '22.11.0' # jod - cache: 'yarn' - - - name: Yarn cache - uses: actions/cache@v3 - with: - path: | - **/node_modules - key: web-core-modules-${{ hashFiles('/package.json', '/yarn.lock') }} - - - - uses: actions/cache@v3 - id: nextjs-cypress-cache - with: - path: | - ${{ github.workspace }}/.next/cache - /home/runner/.cache/Cypress - key: ${{ runner.os }}-nextjs-cypress-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} - restore-keys: | - ${{ runner.os }}-nextjs-cypress- - - - name: Yarn install - shell: bash - run: yarn install --immutable - - name: Yarn after install - shell: bash - run: yarn after-install