-
Notifications
You must be signed in to change notification settings - Fork 5
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
Specifying resolver in stack-arguments
#26
Comments
Yeah, you're right that Originally, it was meant to represent arguments to So we should probably ensure we supply them to all stack invocations. I just wonder if something needed for |
I think it's enough to have Something like this with ternary expressions.
|
I like that. Would you like to make a PR? |
Yes. What's the purpose of Lines 131 to 133 in ac0dd8d
|
If we have specific Lines 12 to 19 in ac0dd8d
They remove some duplication in common cases, but may conflict with |
You can only set a specific
I could be convinced either way, but I think so. I think the de-duplication is a better trade-off than the risk of any edge-case.
I think this might be a typo, I think you mean does specify In other words, if the edge-case that breaks is a user specifying: with:
fast: true
stack-build-arguments: --fast Or with:
pedantic: true
stack-test-arguments: --pedantic I think it's reasonable that that fails and we just say, please just do one or the other. |
Sorry for a delay. Okay, got it about
I think a warning in the docs should be provided to not specify |
Maybe Otherwise, I agree with a warning in the documentation. Though I would probably have it say that one simply should never add |
In #35 (I refer to this commit), there is the Setting the default value of I think that dropping Of course, this change will require a major version bump. |
Ah, I don't think I understood this. I thought Something like, stack-yaml:
default: "stack.yaml"
stack-arguments:
description: global arguments to all `stack` invocations, in addition to, --stack-yaml, and --resolver nightly
default: ""
stack-build-arguments:
description: arguments passed to all `stack build` invocations
default: "--fast"
stack-build-arguments-test:
description: arguments passed to the `stack build --test` invocation
default: "" Then, for example, the Test step would be: - name: Test
run: |
stack \
${resolver-nightly-if-necessary} \
--stack-yaml ${inputs.stack-yaml} \
${inputs.stack-arguments} \
build ${inputs.stack-build-arguments} \
--test ${inputs.stack-build-arguments-test} Do I have that right?
Yeah, I think the more we look at this, the more I'm finding we'll end up with a bump no matter what. So we might as well rethink it from scratch. |
Not exactly. I modified the meaning of So, we have: stack-arguments:
description: "Additional arguments for stack invocations"
stack-build-arguments:
description: "Additional arguments in all `stack build` invocations. Can not be overriden by other action inputs."
stack-build-arguments-default:
description: "Additional arguments in `stack build` invocations. Can be overriden by other action inputs."
stack-build-arguments-dependencies:
description: "When a non-empy string, overrides the input `stack-build-arguments-default` on the `Dependencies` step."
Here's a part of the PR: # Setup step
echo "stack-build-arguments-build=${stack_build_arguments[*]} ${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-build != '' && inputs.stack-build-arguments-build || inputs.stack-build-arguments-default }}" >>"$GITHUB_OUTPUT"
# Build step
stack ${{ steps.setup.outputs.stack-arguments }} \
build --test --no-run-tests \
${{ steps.setup.outputs.stack-build-arguments-build }} Should I rename |
I think it's OK to call it I don't see a lot of value in |
I also like this shorter name.
Yes, I disagree.
|
OK, I see. So, let's say you wanted with:
stack-build-arguments-default: --fast
stack-build-arguments-?: --fast --pedantic
stack-build-arguments-test: --fast --pedantic |
A space is (hopefully) not an empty string. with:
stack-build-arguments: --fast
stack-build-arguments-default: --pedantic
stack-build-arguments-test: ' ' |
Ah OK. So I'm guessing you meant, with:
stack-build-arguments: --fast
stack-build-arguments-default: --pedantic
stack-build-arguments-dependencies: ' ' That seems kind of confusing and hard to intuit to me. I also really don't like that you have to use non-empty white-space with special semantics. Even if we built it this way, I would probably tell my team to not do that and do something like this instead: with:
stack-build-arguments: --fast
stack-build-arguments-build: --pedantic
stack-build-arguments-test: --pedantic Or, with:
stack-build-arguments-dependencies: --fast
stack-build-arguments-build: --fast --pedantic
stack-build-arguments-test: --fast --pedantic This is still 3 options, and it just seem easier to reason about, which is further evidence, IMO, that That said, I guess users are free to do it any of these ways, so we just have to decide if the implementation of |
Yep. Sorry for the misleading typo.
I looked at the examples and now feel the same. After all,
As a PR writer, I'd like to bring to the project gradual improvements rather than unnecessary complexity. I've just removed the |
This is addressed in |
When specifying
stack-arguments: --resolver lts-19.33
, the github action outputsRun tmp=$(mktemp) actual: ghc-9.4.5 wanted: ghc-9.4.5
Scrolling through the log, I can see that the correct GHC version is used (
Preparing to download ghc-tinfo6-9.0.2 ...
) in the build.The steps
stack-query
andstack-path
do not pass${{ inputs.stack-arguments }}
to the call tostack
. This does produce incorrect information, if I am not mistaken.I am also wondering whether the "Dependencies" step works correctly (I am new to stack as well as to github actions). The corresponding run code is
The
setup
sub-command is using a different resolver than the build command in case a resolver was explicitly provided instack-arguments
. In thesetup
step, GHC 9.4.5 is downloaded but then thebuild
step uses the correct version:Cache not found for input keys: lts-19.33/Linux-stack [...] Preparing to install GHC (tinfo6) to an isolated location. This will not interfere with any system-level installation. Preparing to download ghc-tinfo6-9.4.5 ... [...] Installed GHC. Stack will use a sandboxed GHC it installed. To use this GHC and packages outside of a project, consider using: stack ghc, stack ghci, stack runghc, or stack exec. Preparing to install GHC (tinfo6) to an isolated location. This will not interfere with any system-level installation. Preparing to download ghc-tinfo6-9.0.2 ... [...] Installed GHC. [1 of 2] Compiling Main ( /home/runner/.stack/setup-exe-src/setup-6HauvNHV.hs, /home/runner/.stack/setup-exe-src/setup-6HauvNHV.o )
Will caching work as I intend when adding
cache-prefix: lts-19.33/
to the action (as seems to be the correct way according the this actions's workflow file?)The text was updated successfully, but these errors were encountered: