Skip to content

Commit

Permalink
first pass on only emulate if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Mar 14, 2024
1 parent 7197136 commit 20dac7b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-func-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
matrix:
os:
- macos-13
- macos-14
- ubuntu-22.04
- windows-2022
steps:
Expand Down
27 changes: 23 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ runs:
echo "target-os=${{ inputs.os }}" >> $GITHUB_OUTPUT
fi
if [ "${{ runner.arch }}" == "X86" ]; then
echo "runner-arch=x64" >> $GITHUB_OUTPUT
elif [ "${{ runner.arch }}" == "X64" ]; then
echo "runner-arch=x64" >> $GITHUB_OUTPUT
elif [ "${{ runner.arch }}" == "ARM" ]; then
echo "runner-arch=arm64" >> $GITHUB_OUTPUT
elif [ "${{ inputs.arch }}" == "ARM64" ]; then
echo "runner-arch=arm64" >> $GITHUB_OUTPUT
echo "runner-arch=${{ runner.arch }}" >> $GITHUB_OUTPUT
fi
if [ "${{ inputs.arch }}" == "X86" ]; then
echo "target-arch=x64" >> $GITHUB_OUTPUT
elif [ "${{ inputs.arch }}" == "X64" ]; then
Expand All @@ -97,6 +108,14 @@ runs:
echo "target-node=node${{ inputs.node-version }}" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Validate arch emulation requirements
shell: bash
run: |
if [ "${{ steps.pkg-action-internal.outputs.target-arch }}" != "${{ steps.pkg-action-internal.outputs.runner-arch }}" ]; then
echo "::notice title=Emulation needed::Emulating ${{ steps.pkg-action-internal.outputs.target-arch }} on ${{ steps.pkg-action-internal.outputs.runner-arch }}"
# exit 47
fi
- name: Install node ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -127,8 +146,8 @@ runs:
echo "artifact-key=${{ github.event.repository.name }}-${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }}-${{ github.sha }}" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Run x64 pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == 'x64'
- name: Run native ${{ steps.pkg-action-internal.outputs.target-arch }} pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == steps.pkg-action-internal.outputs.runner-arch
shell: bash
env:
RUNNER_DEBUG: ${{ env.RUNNER_DEBUG }}
Expand All @@ -151,8 +170,8 @@ runs:
fi
stat ${{ steps.pkg-action.outputs.file }}
- name: Run arm64 pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == 'arm64'
- name: Run emulated ${{ steps.pkg-action-internal.outputs.target-arch }} pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == 'arm64' && steps.pkg-action-internal.outputs.runner-arch == 'x64'
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
Expand Down

0 comments on commit 20dac7b

Please sign in to comment.