-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CI: Extract and don't hardcode artifact naming #3463
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
Conversation
6268ab3 to
a8b09b5
Compare
Deploying wasp-docs-on-main with
|
| Latest commit: |
935a6bf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6f38d859.wasp-docs-on-main.pages.dev |
| Branch Preview URL: | https://cprecioso-separate-workflows.wasp-docs-on-main.pages.dev |
e6a39bd to
3eff1c1
Compare
3eff1c1 to
be4e42f
Compare
be4e42f to
23209a6
Compare
23209a6 to
e0ad7c1
Compare
e0ad7c1 to
89d55e7
Compare
89d55e7 to
6ad9ba9
Compare
6ad9ba9 to
4ab3cb2
Compare
4ab3cb2 to
4ae72a3
Compare
4ae72a3 to
6ab98fc
Compare
6ab98fc to
afd026c
Compare
afd026c to
10f3781
Compare
10f3781 to
1e26277
Compare
1e26277 to
0c112c0
Compare
8d00426 to
95d63da
Compare
0c112c0 to
935a6bf
Compare
infomiho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
| # Using the ::error:: prefix lets GitHub handle it as a special string, and shows up as a red error in the logs. | ||
| # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-an-error-message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the fence if we need this comment, for example, you are not explaining the fromJson API for Github Action etc.
But I'm okay if we keep it 👍
RAW
| set -ex # Fail on error and print each command | ||
| input_arch=( | ||
| macos-x86_64 | ||
| macos-aarch64 | ||
| input_files=( | ||
| "$X86_64_TARBALL_NAME" | ||
| "$AARCH64_TARBALL_NAME" | ||
| ) | ||
| # Extract each architecture | ||
| for arch in "${input_arch[@]}"; do | ||
| mkdir "arch-$arch" | ||
| tar -xzf "wasp-cli-${arch}/wasp-${arch}.tar.gz" -C "arch-$arch" | ||
| i=0; | ||
| for file in "${input_files[@]}"; do | ||
| mkdir "arch-$i" | ||
| tar -xzf "$file" -C "arch-$i" | ||
| i=$((i + 1)) | ||
| done | ||
| mkdir universal | ||
| # Create the universal binary | ||
| lipo -create arch-*/wasp-bin -output universal/wasp-bin | ||
| # Copy the data folder too | ||
| cp -R "arch-${input_arch[0]}/data" universal/ | ||
| # Copy the data folder too (we take the first one, should be identical in both) | ||
| cp -R "arch-0/data" universal/ | ||
| # Pack back up | ||
| tar -czf wasp-macos-universal.tar.gz -C universal . | ||
| tar -czf ${{ steps.compute-artifact-names.outputs.tarball-name }} -C universal . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something feels off about using $i here for me. I asked some of my LLM buddies to help me with some suggestions:
- You could use
for i in "${!input_files[@]}"; doto get the array indicies which lets you dotar -xzf "${input_files[$i]}" -C "arch-$i". - Another suggestion was to go fully explicit with something like:
set -ex # Create semantic directories mkdir x86_64 aarch64 universal # Extract specifically to those directories tar -xzf "$X86_64_TARBALL_NAME" -C x86_64 tar -xzf "$AARCH64_TARBALL_NAME" -C aarch64 # Create the universal binary # Now it is obvious which inputs are being used lipo -create x86_64/wasp-bin aarch64/wasp-bin -output universal/wasp-bin # Copy data from one of the sources (explicitly choosing x86_64) cp -R x86_64/data universal/ # Pack back up tar -czf ${{ steps.compute-artifact-names.outputs.tarball-name }} -C universal .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the second option the most readable since this is an exact thing we are doing: creating 1 universal binary out of Intel and ARM binaries. We don't need the extensibility here, it'll always be that.
Description
waspc-buildworkflow, so that we can reuse it in multiple places (mainly, thefetch-nightly-packages; and in the future the npm packaging script) without repeating ourselves.Type of change
Checklist
I tested my change in a Wasp app to verify that it works as intended.
🧪 Tests and apps:
examples/kitchen-sink/e2e-tests.waspc/data/Cli/templates, as needed.examples/, as needed.examples/tutorials) I updated the tutorial in the docs (and vice versa).📜 Documentation:
web/docs/.🆕 Changelog: (if change is more than just code/docs improvement)
waspc/ChangeLog.mdwith a user-friendly description of the change.web/docs/migration-guides/.versioninwaspc/waspc.cabalto reflect the changes I introduced.