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

v2 improvements and fixes #83

Merged
merged 18 commits into from
Jul 18, 2024
Merged

v2 improvements and fixes #83

merged 18 commits into from
Jul 18, 2024

Commits on Jul 13, 2024

  1. Refactor main source file

    Move the action entry point into a separate file and split the code
    that handles the action's inputs and their default values to a
    separate function. This will make it possible to perform tests on the
    main action function.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    5fa67a9 View commit details
    Browse the repository at this point in the history
  2. src/d.ts: drop restrictive visibility specifiers on members

    Making members public will allow inspecting their values in tests.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    2563280 View commit details
    Browse the repository at this point in the history
  3. src/d.ts: Correct some dmd paths

    Currently, on windows, the action incorrectly sets DC to point to the
    32-bit variant of the executable. This has been fixed by using the
    64-bit variant when it is knows to be available.
    
    On macos the LD_LIBRARY_PATH variable was set incorrectly (to
    `/dmd2/linux/lib`) this did not seem to affect the compiler as there
    aren't any shared libraries available for osx.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    3ff78c0 View commit details
    Browse the repository at this point in the history
  4. src/d.ts: fix some error messages

    Add an error message for dmd being used on non-x86_64 and correct some
    other messages.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    5416293 View commit details
    Browse the repository at this point in the history
  5. action.yml: Stop defaulting to dmd-latest as the D compiler

    There is already code in the action that picks between dmd-latest and
    ldc-latest based on the CPU architecture when a D compiler is not
    specified. Having the default value in action.yml prevented this code
    from ever running. This leads to users receiving an error message and
    having to specify `dc: ldc` manually.
    
    Bug: dlang-community#78
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    fb976cf View commit details
    Browse the repository at this point in the history
  6. Add unittests written in typescript

    Currently all of the tests are written as a github workflow. This
    makes them very inconvenient to run as one would have to be triggering
    the online CI every times they make a change to the code. On top of
    this the tests can only verify the final product of the action, if
    changes are made somewhere deep in the source code and they break
    something it will not be immediately clear what is broken.
    
    For this reason I've written tests in plain typescript that are much
    easier to be run but still check all the platforms (linux, windows,
    and macos) on x86_64 and arm64. These tests are covering a big part of
    the source code, mostly the logic bits in addition to mocking network
    responses for the code that contacts github.com or dlang.org to
    determine the versions that needs to be installed. This should make
    future work on the action way easier.
    
    This doesn't make the old tests obsolete as some parts of the code are
    not easily tested, like fetching release archives and properly
    extracting them.
    
    Add an action that will run the unittests on each system (linux,
    macos, windows) to assure that any person can run the tests on their
    system without failures.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 13, 2024
    Configuration menu
    Copy the full SHA
    1eded35 View commit details
    Browse the repository at this point in the history

Commits on Jul 14, 2024

  1. Set the DMD environment variable for all compilers

    This action sets up DC to point to the compiler. It is not much more
    work to also set DMD to point to the dmd wrapper of the compiler. dmd
    is its own wrapper, ldmd2 comes by default with ldc2. The only one
    left out is gdc.
    
    The action allowed installing gdc, either alone or with gdmd and
    setting DC to point to one of them. This required the user to specify
    which what they wanted to set DC to. This is pointlessly complex as
    gdmd is just a script file that can be easily downloaded. The previous
    decision to do this separately was because of the installation method
    of the gdmd script, it defaulting to installing it through `apt`,
    which would likely lead to many more useless packages being
    installed. This is too much work for just a script file so it will now
    always be installed by fetching it from the upstream repo.  See
    dlang-community#77 (comment)
    for a discussion around this topic.
    
    This has as consequences that the `gdmd` and `gdmd-<version>` inputs
    to `compiler` become invalid and that the `gdmd_sha` inputs becomes
    mandatory. To accommodate for the second issue the action now picks a
    default value for `gdmd_sha`.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    
    Add CI for gdc and gdmd
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    f27d933 View commit details
    Browse the repository at this point in the history
  2. Allow dmd on macos arm64

    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    c56aaa8 View commit details
    Browse the repository at this point in the history
  3. .github/actions/verify-d-compiler: Perform the tests in separate dirs

    Avoid the possibility of mistakenly running a previously generated
    hello executable by performing all the steps in separate directories.
    
    This has shown an issue with the `-shared` test, it never produced an
    executable so invoking the program was useless as it run the one that
    was generated in the previous step. For this reason in that test
    perform only compilation and no longer run any binary.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    82a56b5 View commit details
    Browse the repository at this point in the history
  4. src/gpg.ts: Use @actions/exec instead of promisify-child-process

    Remove the dependency on promisify-child-process by using the exec
    function provided by @actions/exec.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    15a7258 View commit details
    Browse the repository at this point in the history
  5. Don't try to install gpg on macos, it is already installed

    all macos images come with gpg preinstalled, see:
    https://github.com/actions/runner-images/tree/main/images/macos
    for the list of all preinstalled packages.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    9c0785a View commit details
    Browse the repository at this point in the history
  6. Remove dependency on @actions/io as it is unused

    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    0840768 View commit details
    Browse the repository at this point in the history
  7. Update all dependencies

    Update all dependencies to their highest version available.
    
    Change the target option to es2022 from es2017 to match the current
    configuration of the upstream typescript action.
    
    These changes mean that --openssl-legacy-provider is no longer needed
    when building so the option has been dropped from the building step of
    the workflow.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    fa81d22 View commit details
    Browse the repository at this point in the history
  8. src/gpg.ts: Use core.toPosixPath instead of internal implementation

    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    be56a18 View commit details
    Browse the repository at this point in the history
  9. Set fail-fast to false in unittest action

    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    74aa168 View commit details
    Browse the repository at this point in the history
  10. Prevent @actions/core from writing to files in unittests

    Clearing the github defined variables makes @actions/core print to
    stdout instead of writing to the files, which allows the tests to
    mock other platforms without the fear of paths breaking.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    ab33f49 View commit details
    Browse the repository at this point in the history
  11. dub: Use arm64 binaries on arm64 macos when available

    Since version 1.38.1 dub started publishing arm64 releases for macos
    in addition to their x86_64 releases.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    73502c9 View commit details
    Browse the repository at this point in the history
  12. README.md: Reword changelog entries

    Collapse all "from v2" and "from v1" changes into a single category
    and remove entries that document changes internal to the v2 release.
    
    Order the entries by their relevance, most relevant first.
    
    Signed-off-by: Andrei Horodniceanu <[email protected]>
    the-horo committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    21245d7 View commit details
    Browse the repository at this point in the history