Skip to content

ci: modernize and fix GitHub Actions workflow#2717

Open
kevmoo wants to merge 5 commits intoWebAssembly:mainfrom
kevmoo:build_cleanup
Open

ci: modernize and fix GitHub Actions workflow#2717
kevmoo wants to merge 5 commits intoWebAssembly:mainfrom
kevmoo:build_cleanup

Conversation

@kevmoo
Copy link
Contributor

@kevmoo kevmoo commented Mar 14, 2026

  • Bump actions/checkout from v1/v3 to v4 to avoid Node.js deprecation warnings.
  • Bump actions/setup-python from v1 to v5 for the same reason.
  • Add -y to all apt-get install and apt-get update commands to prevent process hangs.
  • Modernize CMake configuration by using -S . -B out instead of manually creating directories and using working-directory: out.
  • Fix the Windows build step missing the -G Ninja flag, ensuring it actually uses the Ninja binary installed in the previous step (issue present since initial GH actions migration in a08df5c).
  • Fix minor typo ('Temporatily' -> 'Temporarily').
  • Unified some install commands

kevmoo added 4 commits March 14, 2026 14:28
- Bump actions/checkout from v1/v3 to v4 to avoid Node.js deprecation warnings.
- Bump actions/setup-python from v1 to v5 for the same reason.
- Add `-y` to all `apt-get install` and `apt-get update` commands to prevent process hangs.
- Modernize CMake configuration by using `-S . -B out` instead of manually creating directories and using `working-directory: out`.
- Fix the Windows build step missing the `-G Ninja` flag, ensuring it actually uses the Ninja binary installed in the previous step (issue present since initial GH actions migration in a08df5c).
- Fix minor typo ('Temporatily' -> 'Temporarily').
- Unified some install commands
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Thanks for all the fixes!

Would you mind splitting out the build.yaml changes that are just updates and typo fixes from the win32 build stuff which seems like more of an actual change?

- uses: actions/checkout@v1
- uses: actions/checkout@v6
with:
fetch-depth: 0
Copy link
Member

Choose a reason for hiding this comment

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

Do we need fetch-depth: 0 for some reason? IIRC this is slower since it fetches the whole history

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fetch-depth: 0 setting was necessary because the lint job relies on the

./scripts/clang-format-diff.sh script (called on line 27 of build.yml).

By default, the actions/checkout step only performs a shallow fetch of the repository (fetching just a single commit, i.e., depth=1).

However, the clang-format-diff.sh script uses Git commands that need to inspect your repository's history to figure out what changed so it only formats modified code:

# Finds the common ancestor commit
MERGE_BASE=$(git merge-base $BRANCH HEAD)
# Runs the formatter only on the diff against the merge base
git clang-format $MERGE_BASE -q --diff -- src/

Without the full Git history fetched (fetch-depth: 0), git merge-base and git clang-format wouldn't be able to find the common ancestor commit locally, causing the CI lint step to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I totally wrote that 😛

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, of course, this is only the lint step, that makes sense.

Why did the v1 version not need this? Did it fetch all the history by default maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

v1 did the full checkout. v6 is being efficient. But too efficient in this case.

- name: mkdir
run: mkdir -p out
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
Copy link
Member

Choose a reason for hiding this comment

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

What is this new external dependency doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That step (the ilammy/msvc-dev-cmd@v1 action) activates the Microsoft Visual C++ (MSVC) Developer Command Prompt environment on the windows-latest GitHub Actions runner.

It was introduced in the very same commit (ea995cd92) you asked about previously, which fixed Windows CI failures.

Here's why it was needed:
The WABT build uses the Ninja build system across all platforms (cmake -G Ninja). On Windows runners, GitHub Actions has multiple compilers installed (both MSVC and MinGW/GCC). If you run CMake with Ninja without explicitly setting up the MSVC environment, CMake might default to using the MinGW gcc compiler instead of Microsoft's cl.exe, or it might fail entirely to find the C/C++ compiler.

By calling - uses: ilammy/msvc-dev-cmd@v1, it injects all the environment variables (like PATH, LIB, and INCLUDE) required for CMake and Ninja to locate and use cl.exe + link.exe correctly for the native Windows build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also revert the bits here that move the Windows build to use Ninja, but it seemed nice to have everything using ninja 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to add more notes so there are bread crumbs if that's helpful – in the actual source

Copy link
Member

Choose a reason for hiding this comment

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

Can you split out the windows->ninja parts? We can discuss those more in a separate PR. The other changes here seem trivially good.

@kevmoo
Copy link
Contributor Author

kevmoo commented Mar 15, 2026 via email

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