input-output-hk / input-output-hk/actions

The `devx` action should prevent users of using unsupported combinations of inputs

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
1
Forks
5
Avg merge
16d 4h
Merged PRs (30d)
1

Description

Currently, there is nothing that forbid [`devx` GitHub Action](https://github.com/input-output-hk/actions/blob/latest/devx/action.yml) users of using unsupported combinations of inputs, as defined in [the exclude list](https://github.com/input-output-hk/devx/blob/main/.github/workflows/main.yml) of the job that populate ghcr.io with `devx` devshell closure.

I'm not sure what would be the best way to achieve that? I can suggest to just add this small python script that would fail if it encounters a conflict (I didn't test it yet):
```python
import os

inputs = {
"platform": os.environ.get('PLATFORM', '').strip(),
"compiler-nix-name": os.environ.get('COMPILER_NIX_NAME', '').strip(),
"target-platform": os.environ.get('TARGET_PLATFORM', '').strip(),
"minimal": os.environ.get('MINIMAL', '').strip(),
"iog": os.environ.get('IOG', '').strip()
}

exclusions = [
# Just cross compiling javascript with ghc 9.6.2 for now
{"compiler-nix-name": "ghc8107", "target-platform": "-js"},
{"compiler-nix-name": "ghc928", "target-platform": "-js"},
# Static builds not working for darwin yet
{"platform": "x86_64-darwin", "target-platform": "-static"},
# Static tools not working right now (so just building "-static-minimal" for now)
{"target-platform": "-static", "minimal": "false"},
# Windows cross compilation only works on x86_64-linux right now.
{"platform": "aarch64-darwin", "target-platform": "-windows"},
{"platform": "aarch64-linux", "target-platform": "-windows"},
{"platform": "x86_64-darwin", "target-platform": "-windows"},
# It does not makes sense to build minimal image that include IOG extra tooling
# ... "-minimal" and "-iog" are mutually exclusive options!
{"minimal": "true", "iog": "true"},
# On darwin the `-js` target require `-minimal` to be set:
{"target-platform": "-js", "platform": "aarch64-darwin", "minimal": "false"},
{"target-platform": "-js", "platform": "x86_64-darwin", "minimal": "false"}
]

for exclusion in exclusions:
if all(inputs[key] == value for key, value in exclusion.items()):
exit(1)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.