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

Fix CI caching/upload with STATIC_DEPS #374

Merged
merged 2 commits into from Jul 5, 2023
Merged

Fix CI caching/upload with STATIC_DEPS #374

merged 2 commits into from Jul 5, 2023

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Jun 28, 2023

CI does not appear to work as intended - for example, none of the CI cases currently appear to respect the "STATIC_DEPS" setting, (e.g. not that no wheel is uploaded where STATIC_DEPS is intended to be true: e.g. https://github.com/lxml/lxml/actions/runs/5287691371/jobs/9568495615

Github Actions doesn't allow matrix values to be structured objects (I believe they are always strings, even if they look like numbers or booleans) and doesn't seem to automatically update the variable environment from matrix.env.VARNAME.

Instead I changed the variables to use the naming convention env-VARNAME and merged them into the job-level variable environment. This makes the CI work as seemingly intended.

I considered using a structured value with the toJSON/fromJSON functions but this is less easy to understand and more error-prone.

The comparison in the if-statement matrix.os.STATIC_DEPS == 'true' is false when given the boolean value true.

It's not clear to me whether matrix.env can indeed be an object or only a string. As documented, only strings are allowed, but I filed an issue requesting clarification.

@scoder
Copy link
Member

scoder commented Jun 28, 2023

Hmm. STATIC_DEPS definitely works. See, for example, the difference between
https://github.com/lxml/lxml/actions/runs/5287691371/jobs/9568490891 (false)
https://github.com/lxml/lxml/actions/runs/5287691371/jobs/9568490754 (true)
The latter builds the dependencies statically, the first doesn't.

@rotu
Copy link
Contributor Author

rotu commented Jun 28, 2023

Hmm. STATIC_DEPS definitely works. See, for example, the difference between ... The latter builds the dependencies statically, the first doesn't.

Interesting. I don't know what I'm looking at - what in the logs tells you that it builds statically?

  1. In both cases, I see the Cache [libs] step is not running (which is what made me think STATIC_DEPS was completely ignored
  2. I do see the STATIC_DEPS environment variable set correctly in the "Run CI" step so I suspect you're right.

@rotu
Copy link
Contributor Author

rotu commented Jun 28, 2023

Aha! I misdiagnosed the issue.

First, here are some dead ends I chased down:

  • Despite documentation that matrix.<property_name> is a string, it can indeed be an object.
  • if: 'true' and if: true both run a step and if: 'false' and if: false both skip that step.
  • Assigning an object to env: ${{ matrix.env }} does indeed work, even though the VSCode plugin "github.vscode-github-actions" does not like it. It does not matter whether the YAML is given in block-style or flow-style.

And the answer:

The issue is the expression ${{ matrix.env.STATIC_DEPS == 'true' }} which evaluates to false because it's checking equality between a boolean and a string.

@rotu rotu marked this pull request as draft June 28, 2023 22:14
@rotu rotu marked this pull request as ready for review July 3, 2023 19:22
@rotu rotu changed the title Fix CI environment variables Fix CI caching/upload with STATIC_DEPS Jul 3, 2023
@scoder scoder merged commit 0a367d0 into lxml:master Jul 5, 2023
30 of 46 checks passed
@scoder
Copy link
Member

scoder commented Jul 5, 2023

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants