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

Typescript rewrite #34

Merged
merged 25 commits into from
Jul 17, 2023

Conversation

Hoverbear
Copy link
Contributor

@Hoverbear Hoverbear commented Jul 11, 2023

Description

Port the action to typescript!

This will let us avoid having bash in this part of the codebase. It also gives us the space to add some more intelligence to the action eg richer logging: https://www.npmjs.com/package/@actions/core

This is a fairly basic and direct port, more a starting point than any added features.

Checklist
  • Tested changes against a test repository
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • (If this PR is for a release) Updated README to point to the new tag (leave unchecked if not applicable)

@Hoverbear Hoverbear self-assigned this Jul 11, 2023
@Hoverbear Hoverbear force-pushed the hoverbear/ds-893-make-installer-action-use-typescript branch from c52aeb1 to 79baecf Compare July 11, 2023 17:36
@Hoverbear Hoverbear force-pushed the hoverbear/ds-893-make-installer-action-use-typescript branch from bfa0bb0 to 195f007 Compare July 13, 2023 15:14
@Hoverbear Hoverbear mentioned this pull request Jul 13, 2023
3 tasks
@Hoverbear Hoverbear marked this pull request as ready for review July 13, 2023 17:13
@Hoverbear Hoverbear requested a review from cole-h July 13, 2023 17:16
action.yml Outdated Show resolved Hide resolved
@Hoverbear
Copy link
Contributor Author

(I invited some testers via social media, not going to merge this for a day at least)

src/main.ts Show resolved Hide resolved
src/main.ts Show resolved Hide resolved
src/main.ts Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Show resolved Hide resolved
args.concat(extra_args);
}

const merged_env = {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder how this behaves in the case where a user specifies env: NIX_INSTALLER_EXTRA_CONF: "asdf" and with: extra-conf: "foo"... Will it choose the input over the env, or error because there are two envs with the same name but conflicting values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In theory a user could not modify the env provided to the javascript!

Copy link
Member

Choose a reason for hiding this comment

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

I meant providing both an env: and a with: to the action that touch the same options. But I don't think it's worth being super defensive about until we see issues about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh ya, fair.

src/main.ts Outdated
// Normal just doing of the install
const binary_path = await this.fetch_binary();
await this.execute_install(binary_path);
// TODO: Add `this.set_github_path()` and remove that from the installer crate
Copy link
Member

Choose a reason for hiding this comment

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

Looks to me like the first part of this was done (I see a this.set_github_path(); above :D)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya I need to make the other side of this, let me cook a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

src/main.ts Outdated Show resolved Hide resolved
src/main.ts Show resolved Hide resolved
@Hoverbear Hoverbear requested a review from cole-h July 14, 2023 16:15
@Hoverbear
Copy link
Contributor Author

Added some handling of if $GITHUB_PATH has already been written (by the installer running as root) so this won't need tight version cadence.

@Hoverbear
Copy link
Contributor Author

There is a bit of a complication here:

  • We release a new version of this action which does the GITHUB_PATH update
  • We release a version of nix-installer in the future which does not do the update
  • Folks running the old version of the nix-installer-action have their CI break because their action isn't doing the GITHUB_PATH update.

We'll need a transitionary period where we have GITHUB_PATH being set in both places, and monitor for use of our old versions for a bit. After a few versions (and no public repos using the old action version) we can remove the old GITHUB_PATH code.

I think in the meantime we should have the nix-installer output a warning to update the nix-installer-action if it detects it's in CI.

Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

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

Looking good!

@Hoverbear
Copy link
Contributor Author

I think it should gracefully handle #34 (comment) now.

@Hoverbear Hoverbear enabled auto-merge July 17, 2023 18:09
@Hoverbear Hoverbear merged commit 3ebd1ae into main Jul 17, 2023
2 checks passed
@cole-h cole-h deleted the hoverbear/ds-893-make-installer-action-use-typescript branch August 14, 2023 20:15
dc-tec pushed a commit to dc-tec/nixvim that referenced this pull request Aug 7, 2024
… v13 (#18)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[DeterminateSystems/nix-installer-action](https://github.com/DeterminateSystems/nix-installer-action)
| action | major | `v1` -> `v13` |

---

### Release Notes

<details>
<summary>DeterminateSystems/nix-installer-action
(DeterminateSystems/nix-installer-action)</summary>

###
[`v13`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v13)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v12...v13)

##### What's Changed

This update primarily improves the docker shim mechanism.

- science: probes to debug fly on GHA by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#99
- bump by [@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#100
- Update detsys-ts by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#102
- Update detsys-ts: Merge pull request
[#&#8203;51](https://github.com/DeterminateSystems/nix-installer-action/issues/51)
from DeterminateSystems/add-missing-actions-to-update-matrix

Add missing Actions to update matrix by
[@&#8203;detsys-pr-bot](https://github.com/detsys-pr-bot) in
[DeterminateSystems/nix-installer-action#103

- Update `detsys-ts`: Merge pull request
[#&#8203;103](https://github.com/DeterminateSystems/nix-installer-action/issues/103)
from
detsys-pr-bot/detsys-ts-update-515d00bc192ae4460e2122572ebc24020c58ea95
by [@&#8203;detsys-pr-bot](https://github.com/detsys-pr-bot) in
[DeterminateSystems/nix-installer-action#105
- Update `detsys-ts`: by
[@&#8203;detsys-pr-bot](https://github.com/detsys-pr-bot) in
[DeterminateSystems/nix-installer-action#104
- README: correct the source-url parameter docs by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#108
- Share /lib64 into the container by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#109

##### New Contributors

- [@&#8203;detsys-pr-bot](https://github.com/detsys-pr-bot) made their
first contribution in
[DeterminateSystems/nix-installer-action#103

**Full Changelog**:
DeterminateSystems/nix-installer-action@v12...v13

###
[`v12`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v12)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v11...v12)

#### What's Changed

- Fix ESM build by [@&#8203;lucperkins](https://github.com/lucperkins)
in
[DeterminateSystems/nix-installer-action#83
- Revert "Fix ESM build" by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#86
- Add CI run for aarch64-darwin by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#87
- Update action.yml description for source-url by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#89
- Provide new test matrix for source-\* inputs by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#91
- Disable docker under act by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#90
- Update detsys-ts by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#93
- tests: make megajob block on failure by
[@&#8203;cole-h](https://github.com/cole-h) in
[DeterminateSystems/nix-installer-action#96
- Srv update by [@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#97
- Update detsys-ts (status page changes) by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#98

**Full Changelog**:
DeterminateSystems/nix-installer-action@v11...v12

###
[`v11`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v11)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v10...v11)

#### What's Changed

- Rebase on top of detsys-ts for abstracting over
install.determinate.systems by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#74
- Update detsys-ts by [@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#75
- Gracefully handle FlakeHub login failure by
[@&#8203;cole-h](https://github.com/cole-h) in
[DeterminateSystems/nix-installer-action#77
- General JS cleanup by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#76
- Fix broken CI caused by Nix reinstallation wiping out the Magic Nix
Cache by [@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#79
- Standardize on v4 of the checkout action by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#80
- Switch to tsup for building by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#82
- Update dependencies by [@&#8203;grahamc](https://github.com/grahamc)
in
[DeterminateSystems/nix-installer-action#85

**Full Changelog**:
DeterminateSystems/nix-installer-action@v10...v11

###
[`v10`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v10)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v9...v10)

#### What's Changed

- action: post-run-job: try clean daemon container, warn on failure by
[@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#61
- No longer require sudo by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#64
- Handle docker not existing. by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#66
- Don't use docker shim if only using a mounted docker.sock instead of
docker-in-docker by [@&#8203;Hoverbear](https://github.com/Hoverbear)
in
[DeterminateSystems/nix-installer-action#67
- DETERMINATE_NIX_KVM fixup, support Magic Nix Cache + FlakeHub Cache on
Namespace runners by [@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#72

**Full Changelog**:
DeterminateSystems/nix-installer-action@v9...v10

###
[`v9`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v9)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v8...v9)

#### What's Changed

- Support GitHub Enterprise Server in the access-token config. by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#58
- Support GitHub Enterprise Server using ARC by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#59

**Full Changelog**:
DeterminateSystems/nix-installer-action@v8...v9

###
[`v8`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v8)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v7...v8)

Enables KVM out of the box, for snappy NixOS VM tests.

#### What's Changed

- KVM support out of the box, plus a refreshed README by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#56

**Full Changelog**:
DeterminateSystems/nix-installer-action@v7...v8

###
[`v7`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v7)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v6...v7)

This release should reduce or eliminate `ETXTBSY` related errors by
relying on the official Github Actions [tool
cache](https://github.com/actions/toolkit/tree/master/packages/tool-cache).
This tool cache includes retry support if a download request fails.

On [Namespace
Runners](https://cloud.namespace.so/docs/features/faster-github-actions)
the action should correctly detect that `--init none` must be passed to
the installer.

#### What's Changed

- .github: allow trigger ci manually by
[@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#45
- main.ts: fixup logic to ensure only one installer url override is set
by [@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#44
- Retry (w/ back-off) downloading the installer binary by
[@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#46
- Add check for dist folder by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#48
- fix: end the FileStreamWriter for the installer file by
[@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#47
- eslint/tsconfig: validate no floating Promises, adjust tsconfig by
[@&#8203;colemickens](https://github.com/colemickens) in
[DeterminateSystems/nix-installer-action#49
- Detect whether we're running in a Namespace runner, and if so, set
`init: none` by [@&#8203;hugosantos](https://github.com/hugosantos) in
[DeterminateSystems/nix-installer-action#52
- Use Github Actions provided tool cache and exec by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#53

#### New Contributors

- [@&#8203;colemickens](https://github.com/colemickens) made their
first contribution in
[DeterminateSystems/nix-installer-action#45
- [@&#8203;hugosantos](https://github.com/hugosantos) made their first
contribution in
[DeterminateSystems/nix-installer-action#52

**Full Changelog**:
DeterminateSystems/nix-installer-action@v6...v7

###
[`v6`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v6)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v5...v6)

Update to node20

#### What's Changed

- Update the action to use node20 by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#41

**Full Changelog**:
DeterminateSystems/nix-installer-action@v5...v6

###
[`v5`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v5)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v4...v5)

Support for Act, and beta support for private Flakes on FlakeHub

#### What's Changed

- Update README.md to say v4 by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#27
- Add act support by [@&#8203;Hoverbear](https://github.com/Hoverbear)
in
[DeterminateSystems/nix-installer-action#30
- \--nix-build-user-base and --nix-build-user-prefix logic no longer
confused by [@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#32
- Fix specifying a custom planner by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#35
- Typescript rewrite by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#34
- Post run diagnostics by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#39
- Support private flakes on FlakeHub by
[@&#8203;grahamc](https://github.com/grahamc) in
[DeterminateSystems/nix-installer-action#38

**Full Changelog**:
DeterminateSystems/nix-installer-action@v4...v5

###
[`v4`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v4)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v3...v4)

#### What's Changed

- Update example in README to use v3 by
[@&#8203;ajaxbits](https://github.com/ajaxbits) in
[DeterminateSystems/nix-installer-action#25
- Add a ?ci=github to GHA requests, to help us test GHA-specific fixes
more quickly and perform more controlled roll-outs of new releases.
[DeterminateSystems/nix-installer-action#26

#### New Contributors

- [@&#8203;ajaxbits](https://github.com/ajaxbits) made their first
contribution in
[DeterminateSystems/nix-installer-action#25

**Full Changelog**:
DeterminateSystems/nix-installer-action@v3...v4

###
[`v3`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v3)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v2...v3)

A minor release to address
[DeterminateSystems/nix-installer-action#21.

#### What's Changed

- v0.9.0 - nix profile location change by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#22
- In GHA use Hello instead of fortune by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#23

**Full Changelog**:
DeterminateSystems/nix-installer-action@v2...v3

###
[`v2`](https://github.com/DeterminateSystems/nix-installer-action/releases/tag/v2)

[Compare
Source](https://github.com/DeterminateSystems/nix-installer-action/compare/v1...v2)

#### What's Changed

- Add missing setting to README table by
[@&#8203;lucperkins](https://github.com/lucperkins) in
[DeterminateSystems/nix-installer-action#14
- README: use tagged release by
[@&#8203;cole-h](https://github.com/cole-h) in
[DeterminateSystems/nix-installer-action#17
- add option to change diagnostic endpoint by
[@&#8203;Mic92](https://github.com/Mic92) in
[DeterminateSystems/nix-installer-action#16
- Reflect removal of channels in upcoming version by
[@&#8203;cole-h](https://github.com/cole-h) in
[DeterminateSystems/nix-installer-action#18
- Reflect v0.6.0 changes by
[@&#8203;Hoverbear](https://github.com/Hoverbear) in
[DeterminateSystems/nix-installer-action#19

#### New Contributors

- [@&#8203;Mic92](https://github.com/Mic92) made their first
contribution in
[DeterminateSystems/nix-installer-action#16

**Full Changelog**:
DeterminateSystems/nix-installer-action@v1...v2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/dc-tec/nixvim).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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