Skip to content
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

Add GitHub workflow for wasm-wasi-component #1175

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Conversation

ac000
Copy link
Member

@ac000 ac000 commented Mar 6, 2024

This adds a GitHub CI workflow for the new wasm-wasi-component language module.

Some things of note.

  1. We need to special case 'wasm-wasi-component' in the 'Output build
    metadata' section as we are splitting the module names on '-' to
    split them into name and version.

  2. Apart from needing to tell bindgen about the njs include paths, we
    also need to explicitly specify which version of clang to use to
    work around an issue with multiple versions of clang installed.

@ac000 ac000 force-pushed the wasm-wc-ci branch 13 times, most recently from 53bfd88 to 77d9079 Compare March 6, 2024 03:56
@ac000 ac000 changed the title [WIP] Add GitHub workflow for wasm-wasi-component Add GitHub workflow for wasm-wasi-component Mar 6, 2024
@ac000 ac000 marked this pull request as ready for review March 6, 2024 03:59
@ac000 ac000 requested a review from arbourd March 6, 2024 04:21
Comment on lines +326 to +320
##
## wasm-wasi-component
##

- name: Setup rust
run: |
curl https://sh.rustup.rs | sh -s -- -y
if: steps.metadata.outputs.module == 'wasm-wasi-component'

- name: Configure wasm-wasi-component
run: |
./configure wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'

- name: Make wasm-wasi-component
run: |
CLANG_PATH=/usr/bin/clang-15 \
BINDGEN_EXTRA_CLANG_ARGS="-I../../njs/src -I../../njs/build" \
make wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense just to include this in the wasm step?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did at first, but then thought it was sufficiently different...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Looks to good to me 👍🏻

Comment on lines +355 to +338
if: steps.metadata.outputs.module != 'wasm' &&
steps.metadata.outputs.module != 'wasm-wasi-component'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also do

Suggested change
if: steps.metadata.outputs.module != 'wasm' &&
steps.metadata.outputs.module != 'wasm-wasi-component'
if: startsWith(steps.metadata.outputs.module, 'wasm')

startsWith is a builtin

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's neater, although we may get tests for one before the other... then it's aonly a matter of removing one of the conditions vs changing the whole thing... I'm 50/50...

Comment on lines -76 to +67
# Split the build name by '-' into module and version
IFS='-' read -r module version <<< "${{ matrix.build }}"
if [ "${{ matrix.build }}" = "wasm-wasi-component" ]; then
module="wasm-wasi-component"
else
# Split the build name by '-' into module and version
IFS='-' read -r module version <<< "${{ matrix.build }}"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need to improve upon my hacky language-version idea eventually, but this works for now! 😄

This adds a GitHub CI workflow for the new wasm-wasi-component language
module.

Some things of note.

1) We need to special case 'wasm-wasi-component' in the 'Output build
   metadata' section as we are splitting the module names on '-' to
   split them into name and version.

2) Apart from needing to tell bindgen about the njs include paths, we
   also need to explicitly specify which version of clang to use to
   work around an issue with multiple versions of clang installed.

Link: <https://gitlab.freedesktop.org/mesa/mesa/-/issues/7268>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
@ac000
Copy link
Member Author

ac000 commented Mar 7, 2024

  • Rebased with master
$ git range-diff 16bd12b3...0cee7d1a
-:  -------- > 1:  8032ce31 Test with root access in GitHub workflows
1:  16bd12b3 ! 2:  0cee7d1a Add GitHub workflow for wasm-wasi-component
    @@ .github/workflows/ci.yml: jobs:
      
            - name: Install pytest
              run: |
    -           pip install pytest
    +           sudo -H pip install pytest
     -        if: steps.metadata.outputs.module != 'wasm'
     +        if: steps.metadata.outputs.module != 'wasm' &&
     +            steps.metadata.outputs.module != 'wasm-wasi-component'
      
            - name: Run ${{ steps.metadata.outputs.module }} tests
              run: |
    -           pytest --print-log ${{ steps.metadata.outputs.testpath }}
    +           sudo -E pytest --print-log ${{ steps.metadata.outputs.testpath }}
              # Skip pytest if wasm build, as there are no tests yet
     -        if: steps.metadata.outputs.module != 'wasm'
     +        if: steps.metadata.outputs.module != 'wasm' &&

@ac000 ac000 merged commit 0cee7d1 into nginx:master Mar 7, 2024
18 checks passed
@ac000 ac000 deleted the wasm-wc-ci branch March 7, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants