-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: separate setup dependencies from EAS push job #24916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d4c73e7
ca9c4e8
00e4d09
024b543
0cff80c
018568b
4079bbe
b367a60
121ed17
e06762d
eb4cf39
ae5bd7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: 'Restore Node Modules Executable Permissions' | ||
| description: 'Restores executable permissions for node_modules binaries after artifact download' | ||
|
|
||
| inputs: | ||
| working-directory: | ||
| description: 'Working directory where node_modules is located' | ||
| required: false | ||
| default: '.' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Restore executable permissions | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
| run: | | ||
| echo "🔧 Restoring executable permissions..." | ||
| find node_modules/.bin -type f -exec chmod +x {} \; 2>/dev/null || true | ||
| find node_modules -type f -name "*.node" -exec chmod +x {} \; 2>/dev/null || true | ||
| find node_modules -path "*/bin/*" -type f -exec chmod +x {} \; 2>/dev/null || true | ||
| find node_modules -path "*/sdks/*" -type f -exec chmod +x {} \; 2>/dev/null || true | ||
| echo "✅ Permissions restored" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: 'Validate Artifact Compatibility' | ||
| description: 'Validates that the artifact was built with compatible Node version and OS' | ||
|
|
||
| inputs: | ||
| artifact-name: | ||
| description: 'The actual artifact name to validate' | ||
| required: true | ||
| artifact-prefix: | ||
| description: 'The expected artifact prefix (e.g., node-modules-eas-update-pr or node-modules-eas-update-base)' | ||
| required: true | ||
| validation-context: | ||
| description: 'Description of what is being validated (e.g., "PR commit", "base branch")' | ||
| required: false | ||
| default: 'artifact' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Validate artifact compatibility | ||
| shell: bash | ||
| run: | | ||
| NODE_VERSION=$(node --version | sed 's/v//') | ||
| OS_NAME=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') | ||
| EXPECTED_ARTIFACT="${{ inputs.artifact-prefix }}-node${NODE_VERSION}-${OS_NAME}" | ||
|
|
||
| echo "🔍 Validating ${{ inputs.validation-context }} artifact compatibility..." | ||
| echo " Expected artifact: $EXPECTED_ARTIFACT" | ||
| echo " Actual artifact: ${{ inputs.artifact-name }}" | ||
|
|
||
| if [ "$EXPECTED_ARTIFACT" != "${{ inputs.artifact-name }}" ]; then | ||
| echo "::error title=Artifact Incompatibility::Node version or OS mismatch detected!" | ||
| echo "❌ The node_modules artifact was built with different Node version or OS" | ||
| echo " This could cause issues with native node modules" | ||
| echo " Expected: $EXPECTED_ARTIFACT" | ||
| echo " Actual: ${{ inputs.artifact-name }}" | ||
| exit 1 | ||
| fi | ||
| echo "✅ ${{ inputs.validation-context }} artifact compatibility validated" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| # Reusable workflow for setting up node_modules | ||
| # This workflow installs dependencies and runs the project setup, then uploads | ||
| # the prepared node_modules as an artifact for consumption by other workflows. | ||
|
|
||
| name: Setup Node Modules | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| ref: | ||
| description: 'Git ref to checkout (e.g., refs/pull/123/head or branch name)' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| fetch-depth: | ||
| description: 'Number of commits to fetch (0 for all history)' | ||
| required: false | ||
| type: number | ||
| default: 1 | ||
| upload-artifact: | ||
| description: 'Whether to upload node_modules as an artifact' | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
| artifact-name: | ||
| description: 'Name of the artifact to upload' | ||
| required: false | ||
| type: string | ||
| default: 'node-modules' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also we can change the name of the node modules artifcact to include the node version and the OS name. We should pick those from the environment itself. That way we can check it on the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is done below when we do name: Set artifact name with node version and OS |
||
| artifact-retention-days: | ||
| description: 'Number of days to retain the artifact' | ||
| required: false | ||
| type: number | ||
| default: 1 | ||
| outputs: | ||
| artifact-name: | ||
| description: 'The actual artifact name used (includes node version and OS)' | ||
| value: ${{ jobs.setup.outputs.artifact-name }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| setup: | ||
| name: Setup Node Modules | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| artifact-name: ${{ steps.set-artifact-name.outputs.artifact-name }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
| fetch-depth: ${{ inputs.fetch-depth }} | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Set artifact name with node version and OS | ||
| id: set-artifact-name | ||
| run: | | ||
| NODE_VERSION=$(node --version | sed 's/v//') | ||
| OS_NAME=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') | ||
| ARTIFACT_NAME="${{ inputs.artifact-name }}-node${NODE_VERSION}-${OS_NAME}" | ||
| echo "artifact-name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" | ||
| echo "📦 Artifact name: $ARTIFACT_NAME" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| echo "📦 Installing dependencies..." | ||
| yarn install --immutable | ||
|
|
||
| - name: Setup project | ||
| run: | | ||
| echo "🔧 Running setup for GitHub CI..." | ||
| yarn setup:github-ci | ||
|
|
||
| - name: Verify setup completed | ||
| run: | | ||
| echo "✅ Verifying setup artifacts..." | ||
| # Check that critical setup artifacts exist | ||
| if [ ! -d "node_modules" ]; then | ||
| echo "❌ node_modules directory not found" | ||
| exit 1 | ||
| fi | ||
| if [ ! -f "app/util/termsOfUse/termsOfUseContent.ts" ]; then | ||
| echo "❌ Terms of Use content not generated" | ||
| exit 1 | ||
| fi | ||
| if [ ! -f "app/core/InpageBridgeWeb3.js" ]; then | ||
| echo "❌ InpageBridgeWeb3.js not generated" | ||
| exit 1 | ||
| fi | ||
| echo "🔍 Checking yarn setup..." | ||
| echo " Node version: $(node --version)" | ||
| echo " Yarn version: $(yarn --version)" | ||
| echo " Corepack version: $(corepack --version)" | ||
| echo "✅ Setup verification passed" | ||
|
|
||
| - name: Debug - List .yarn contents | ||
| run: | | ||
| echo "📂 Contents of .yarn directory:" | ||
| ls -la .yarn/ || echo "No .yarn directory" | ||
| echo "📊 .yarn size: $(du -sh .yarn 2>/dev/null || echo 'N/A')" | ||
| echo "📄 install-state.gz exists: $(test -f .yarn/install-state.gz && echo 'yes' || echo 'no')" | ||
| echo "📁 cache dir exists: $(test -d .yarn/cache && echo 'yes' || echo 'no')" | ||
|
|
||
| - name: Upload node_modules artifact | ||
| if: inputs.upload-artifact | ||
| uses: actions/upload-artifact@v4.5.0 | ||
| with: | ||
| name: ${{ steps.set-artifact-name.outputs.artifact-name }} | ||
| path: | | ||
| node_modules | ||
| app/util/termsOfUse/termsOfUseContent.ts | ||
| app/core/InpageBridgeWeb3.js | ||
| scripts/inpage-bridge/dist | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| retention-days: ${{ inputs.artifact-retention-days }} | ||
| compression-level: 1 | ||
| if-no-files-found: warn | ||
|
weitingsun marked this conversation as resolved.
|
||
| include-hidden-files: true | ||
Uh oh!
There was an error while loading. Please reload this page.