Commit Graph

75 Commits

Author SHA1 Message Date
Paulo F. Oliveira 2a21db5504 Ease pre-pull request fork CI as well as github-actions based dispatch (#229) 2023-08-25 17:04:51 +01:00
Paulo F. Oliveira f6a73a7bf1 Rework our version matching algorithm (#217)
* Update some dependencies' versions (also, get rid of husky)

* Introduce branch dependency execution

We want the most important things to fail first and prevent the
other ones from executing

e.g. if your dist/ is not updated, there's no point seeing the tests fail

* Rid ourselves of bloat

* Introduce expectations for upcoming version

* Tweak whitespace

* Tweak our calls to getVersionFromSpec (increase code consistency)

* Remove non-used variable

* Start coercing on input, stop sorting/maybe prepending 'v' on input

We'll deal with all this in a centralized place to make
it easier to reason on the code

* Revamp our getVersionFromSpec

1. stop accepting maybePrependWithV0, since this is only used in specialized
   cases
2. sort versions internally (don't expect it to come sorted)
3. compare rc/strict and .includes in a single go (don't separate these)
4. don't expect already coerced version arrays, coerce them when required
   (the maybeCoerced version had changed already, which means we're smarter
   at putting stuff inside the version array)
5. raise an exception if a semver-invalid version is not flagged as strict

* Reduce our expectations, but still be appropriate to our mission

* Update our tests for our new expectations (start the TDD bit)

* Execute npm run build-dist and keep results

* Increase inter-job dependency

* Don't expect markdownlint to be installed remotely

* Revert "Increase inter-job dependency"

This reverts commit 500b0fe7e9eec1c4f258b4d16b40719ee1d0a1ad.

* Revert "Introduce branch dependency execution"

This reverts commit fbe1317a800d7722f4e8b668c073218263d0ab17.

* Have all the CI workflows run under the same conditions

* Fix as per CI results

* Re-establish the possibility to match versions like 22.3.4.2.1.0

We cheat on the semver matching:
1. we keep an ordered list of versions that respect e.g. 22.3.4
2. if we match 22.3.4 when fetching a version, we get the last value
   from the list of versions that respect it, e.g. 22.3.4.2.1.0
   (since this is ordered, it should work as previously expected)

This increases code complexity for getVersionFromSpec,
but hopefully not by much...

We also remove throw-based test cases (non-versions will fail later,
with null), and add some tests to prove our need code.

* Trim out linting practices

But still keep them useful
2023-07-21 20:56:02 +01:00
Paulo F. Oliveira fa5c1c2428 Improve our community standards (#218)
* Add a bug report template

* Add a feature request template

* Add a pull request template

* Add a security policy

* Lint newer files
2023-07-01 11:26:50 -05:00
Paulo F. Oliveira 145c80cf85 Test Erlang/OTP 26 + Elixir 1.14 on top Windows (#191)
* Add more stuff to test on

* Tweak our debugging (more verbose when the runner is in debug mode)

* Hopefully make it easier to debug

* Have the distribution work :-)

* Adapt to a better reality
2023-06-24 11:27:31 -05:00
Paulo F. Oliveira 977eee5f6e Fix 3rd party licenses updater (action) (#202)
* Act on CI results: fix as per what GitHub Actions is requesting

Seems to have worked up until recently, but then it started
breaking :shrug

* Name the workflow a little better
2023-05-08 19:42:25 -05:00
Paulo F. Oliveira b9783cdeea Ease debugging, fix some CI issues, tweak folder structure (#200)
* Enable debug for OTP versions' listings

* Make it easier to detect

* Prevent error annotation on expected error

The fact that one mirror fails in the above test and others follow
working is test enough for me

A single failing mirror should fail, but it's confusing to have
an error annotation for a success (via continue-on-error) while
not being able to suppress it via GitHub Actions

* Trying to figure out why we have a rebar_core exception

Might simply be that the bug is already fixed and we need to bump rebar3

* Try to debug into non-JSON input

* Prevent error in rebar_core

We're getting Access Denied for
Fetching registry from "https://repo.hex.pm:443/registry.ets.gz?"

* Try to figure out what's breaking tests

* Make jsonParse(...).map failure more understandable

* Ease test maintenance

* Tweak folder structure while moving console._ to core._
2023-05-08 09:31:17 +01:00
Paul Guyot cf692c3264 New option to work with one or more hex.pm mirrors (#197)
* New option to work with one or more hex.pm mirrors

Add a new option called `hexpm-mirrors` for one or more hex.pm mirrors.
Default list is `builds.hex.pm`, so behavior is unaffected unless option is
used.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>

* Implement suggested rewording changes from @paulo-ferraz-oliveira

Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
Signed-off-by: Paul Guyot <pguyot@kallisys.net>

---------

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
2023-05-04 07:27:05 +01:00
Paulo F. Oliveira 2595a954a1 Fix tests (#184)
* Fix licenses

* Be less hopeful

* Prevent remote breakage from breaking our CI
2023-03-29 22:54:51 -05:00
Blake Kostner a255120a82 Remove Dialyzer-specific problem matcher (#182)
* fix: remove dialyzer problem matcher

* remove dialyzer problem matcher test

* remove dist problem matcher
2023-03-29 14:43:12 +01:00
Paulo F. Oliveira 1f06ac36d3 Simulate input github-token to fix unit tests (#174)
* Simulate input to fix unit tests
2023-01-07 13:51:47 -06:00
Bryan Paxton e3f6ffe287 Provide an input for github tokens (#172)
* Provide an input for github tokens

- By providing an input for github tokens with a default users no longer have to pass
  the github token via their environment across workflows.
- Remove GITHUB_TOKEN from our environment in all workflows

* Don't run workflows on main on pull requests

Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
2023-01-06 10:14:27 -06:00
Paulo F. Oliveira 37ac1c5116 Try to prevent 403 when accessing the GitHub API (#168)
* Repeat request on error (while logging it)

* Test one change at a time

* Conditionally authorize requests

This seems to affect Windows builds, so might not be the best solution,
but we're trying to isolate the issue to move forward

* Act on CI results

* Ease consumption via a JSON.parse wrapper

We still throw the error, but in a more controlled manner

* Act on CI results
2023-01-04 07:27:57 +00:00
Paulo F. Oliveira 2d314bc413 Check behaviour on Windows pre- Gleam 0.23 (#166)
* Check behaviour on Windows pre- Gleam 0.23

* Increase consistency with .sh counterpart

* Support older versions (pre 0.22.1) on Windows

* Increase inter-script consistency

* Run `npm run build-dist`

* React to CI results
2022-12-14 09:25:50 -06:00
Paulo F. Oliveira aee3f52e58 Update versions as to not have CI fail (while fixing "non-failing" CI) (#164)
* Make README links usable

* Update versions under test

Otherwise it silently fails with "Error: Requested Erlang/OTP version
(23.2) not found in version list (should you be using option
'version-type': 'strict'?)", which is not too important since this
happens when setup-beam.js is included (which happens in the test
environment only)

* Fix failing Gleam test

I think `gleam check` requires OTP (execution complains about missing
`escript`) where `gleam format` does not
2022-12-11 18:33:12 -06:00
Paulo F. Oliveira 35850967ef Have rebar3.cmd work on a Windows CMD shell (#151)
* Provide a working rebar.cmd for system that need it

(Windows on non-PowerShell)

* Add tests for recent changes

If the "run" were to fail the job would too

* Check if Rust can find it
2022-12-01 19:16:40 +00:00
Blake Kostner b980a5ac9b Ease Elixir escripts execution by adding ${HOME}/.mix/escripts to path (#153)
* feat: add escripts to path

* Update src/install-elixir.ps1

Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>

* add github action combo to test escript

* force install

* use os homedir for escript install path

Co-authored-by: Paulo F. Oliveira <paulo.ferraz.oliveira@gmail.com>
2022-11-22 22:39:36 +00:00
Paulo F. Oliveira c373088147 Ease consumption by means of .tool-versions (#159)
* Ease consumption by means of .tool-versions

* Update as per self-review

* Update as per self-review

* Act on CI results

* Act on CI results

* Act on CI results

This value is check by code, in any case

* Act on CI results

* Act on CI results

* Act on CI results

It appears we can't install Elixir twice on Windows, but can
on Ubuntu; this is outside the scope of this branch's context
so I won't fix it now

* Tweak visual consumption elements

* Ease potential future maintenance and/or update
2022-11-22 22:34:21 +00:00
Paulo F. Oliveira 713cc2ffe3 Move away from set-output (while updating all deps) (#148)
* Update all our deps

Get rid of warnings such as:
* `save-state` will be deprecated
* `set-output` will be deprecated
* nodejs 12 is being deprecated
...

Rely on tests to make sure the actions still works

* Fix as per CI results

* Get rid of deprecated containers

* Have a warningless run

We're not testing rebar3 here, in any case
2022-10-19 21:51:01 +01:00
Paulo F. Oliveira 8d31e4db55 Allow version-type: strict + otp-version: master for Elixir -based builds (#144)
* Check tests failing for something that should pass

* Test with version-type: strict

* Add more tests

GitHub actions is refusing to run a given workflow :shrug

* Try to fix new test that shouldn't be failing

Which is exactly what we intended to originate by starting a new
pull request.

* Fix tests as per CI

* Fix tests as per CI

* Adapt to "latest"

* Fix as per CI results

Actions' window shows everything as Ok but then internals not

Error when evaluating 'runs-on' for job 'integration_test'. .github/workflows/ubuntu.yml (Line: 19, Col: 14): Unexpected type of value '', expected type: OneOf.

Strange one, this one!

* Try to "help" for non-OTP declared input

We do this for OTP-, but not for maint-
as the former is hopefully more common
than the latter

* Introduce `latest` to signify `master`

Semantically they're similar, but with `latest` we know:
1. to fetch Elixir's no-otp-... version
2. to fetch Erlang's master

whereas with 25 (latest at this moment) we'd
try to fetch elixirvsn-otp-25 which could fail with
Elixir master and version-type strict

* Fix as per CI

Still not 100% convinced that `latest` should be separate from `master`
but I want to know how tests run, in this case in particular

* Fix as per CI

* Fix as per CI

* Revert potential wrong decision

* Fix as per understand recent Elixir changes (namely master v. main)

* Try to simplify it

We introduce the concept of version v. branch (as per @ericmj)
and we use that to find the most appropriate Erlang/Elixir combo.
2022-10-19 21:10:26 +01:00
Wojtek Mach 8bfa104bdd Test environment variables are set (#142) 2022-09-16 20:01:17 +02:00
Paulo F. Oliveira 6b2f8153b4 Crash on invalid Elixir+OTP combo (#134)
* Prevent "future" errors when choosing incompatible Elixir v. OTP versions

* Fix tests as per GitHub Actions' output

* Make test elixir `master` strict

It has no -otp- in the name
2022-09-13 08:21:46 +01:00
Louis Pilfold ee0fa0b672 Update for latest Gleam (#138)
* Update for latest Gleam

- Gleam releases now use LLVM triplets for platforms so the download
  URLs have been updated accordingly.
- Gleam's rebar3 support has been removed.

This change means that future versions of this action cannot download
older versions of Gleam. I can make it backwards compatible, but I will
need help from someone who can convert the shell script into PowerShell
for Windows.

* Support older Gleam versions

* Remove rebar from Gleam
2022-09-12 15:35:29 +01:00
Paulo F. Oliveira caa49b0658 Try current state with Ubuntu 22.04 (#124) 2022-07-12 21:59:53 -05:00
Kian-Meng Ang 79c4ce944c Update README: signal OTP-25 as a working version (#122)
See https://github.com/erlef/setup-beam/pull/118
2022-06-27 12:44:56 +01:00
Paulo F. Oliveira ac7b7d515b Test on top of Erlang/OTP 25+ (not RC) (#118)
* Add Erlang/OTP 25+ (not RC) to tests

* Test a specific combo

And a strict version

* Allow testing "edge" cases

We weren't taking our own considerations into account for version strictness
We want to be able to test cases where we use -otp- (if the consumer is doing
it, at least they have to use _strict_ to assert their decision)
2022-05-30 15:11:49 +01:00
Paulo F. Oliveira 2e0500f2a5 Handle strings as such (#100)
* Handle strings as such

* Let automation do its thing
2022-04-07 20:27:52 +01:00
Paulo F. Oliveira c428d8c359 Attempt use on top of Erlang 25.0-rc1 (#93) 2022-02-22 11:09:02 +00:00
Paulo F. Oliveira 2494d08aa0 Add environment variables (#94)
* Allow for Windows'22 container

(win22 is just a guess, at this moment)

* Add environment variables

* Clean up code
2022-02-22 11:05:11 +00:00
Paulo F. Oliveira df03a946e0 Fix 3rd party license updater (#92)
Instead of pushing directly (since the main branch is protected) this creates a pull request
2022-02-22 10:54:04 +00:00
Michał Łępicki 3179686d1f Make OTP installation optional (#81) 2022-01-12 14:26:44 +00:00
Paulo F. Oliveira 65219deb69 Prevent deprecation warnings (#83) 2022-01-12 14:25:57 +00:00
Paulo F. Oliveira c71c5c91bb Allow using rebar3 nightly builds (#84) 2022-01-12 14:25:40 +00:00
Paulo F. Oliveira 3250a83e5a Automate updating 3rd party licenses (#82) 2022-01-12 11:40:11 +00:00
Paulo F. Oliveira c255c7e97f Fix CI as per failure in main (action.yml) (#71)
* Fix CI as per failure in main (action.yml)

* Apply Dependabot alert from GitHub security alert digest

* Keep up with Node.js

* Run action.yml on Node 14 (locally)
2021-09-07 04:15:25 +01:00
Paulo F. Oliveira c988d89031 Add Gleam (#67) 2021-08-03 18:56:12 +01:00
Blake Kostner 4fbbcf2e6c Add Elixir/credo and Elixir/dialyzer problem matchers (#65) 2021-07-27 22:43:22 +01:00
Bryan Paxton ade4f1d567 Don't preprend v when elixir version does not start with digits (#61) 2021-07-20 14:08:24 -05:00
Paulo F. Oliveira 9283f857f1 Improve warning message for missing ImageOS env. variable (self-hosted runners) (#59) 2021-07-12 18:35:08 +01:00
Paulo F. Oliveira 830642517c Improve visibility (+ fix bugs) over version-type and opt-in versions (#57)
(and tweak README regarding action versioning)
2021-07-09 10:11:50 +01:00
Paulo F. Oliveira d8a37f5aac Improve on "Add Windows to the mix" (#52)
* Support more OTP+Windows versions (try to bridge the gap with gleam-lang/setup-erlang that seems to support pre-21 versions)
* Merge ci.yml and test.yml
* Add Elixir to the Windows mix
* Hopefully improve error/warning messages
* Adapt the doc.s to the current reality
* Add option version-type (loose by default, for compatibility)
2021-07-08 15:35:25 +01:00
Paulo F. Oliveira 82b4475ba2 Add Windows to the mix (#49) 2021-06-24 21:58:51 +01:00
Paulo F. Oliveira 11d59b146c Allow for latest 100 rebar3 versions when fetching from GitHub (#42) 2021-05-27 20:28:05 -05:00
Paulo F. Oliveira a550a4c889 Coerce non-semver into semver (#34) 2021-05-15 00:07:41 +01:00
Paulo F. Oliveira d2707f347b Tweak our test combos (#31) 2021-04-19 23:17:55 +01:00
Paulo F. Oliveira 1f3954e2a3 Reduce size of dist (#26) 2021-03-31 19:18:27 +01:00
Paulo F. Oliveira 89cb00455a Introduce rebar-version (#9)
Previously (Remove redundant code) (+27 squashed commits)
Squashed commits:
[0b79c31] Rename as setup-beam
[312b42b] Simplify platform verification
[b43ca96] Prevent use of OTP- prefixed Erlang/OTP versions
[103a236] Move the promise-based approach to an async-based approach

(not testing for failure, so not guaranteeing readable/usable output either)
[1e7f631] Remove local test files
[d03e0c6] Prevent use of -otp- infixed Elixir versions
[697110e] Have versions output in action, not just in tests
[7360781] Ease test validations
[71e6999] Reinstall tests that were there before
[6602f20] Attempt at simplifying regexp matching with build listings
[09247af] Provide for an Elixir to "not OTP" fallback mechanism

(as explained by the comments)
[dfc4083] Attempt at renaming for clarity

We also get rid of return values when not reachable
We also move the `-otp-` part of the Elixir version upstream so it's easy to reason about
  (and update the tests accordingly)
[0d4eb28] Bump our dep.s

(trying to figure out why core.setFailed isn't making the action fail, as it should)
[ebf48ef] Have action fail (with an exception) when no expected version is found

(we otherwise feel that a simple warning is not enough, as it may end up hiding potential bugs)
[8478364] Adapt tests to our actual inputs
[16ea63d] Add prettier again, now sync'ed with jslint

(pass it on the code, already)
[cfc65df] Improve error messages and tests
[a017948] Test unavailable Elixir upon mix
[7f2a3e9] Test failing installations

Also output core.error when expected
[08061ca] Attempt at making shell scripts more robust
[4ee73cb] Separate test code from production code

1. inputs (for CI) are managed by code, not by .yml env. variables
2. rebar3_builds.txt added for stable repeatability
3. tests tweaked to make it easier to modify and drop dependency on production code
4. `dist` regenerated (duplicate files gone)
5. setup-elixir.js tweaked to this new reality
[d17fed4] Remove prettier from the package
[7d6f8f5] Actually break CI when we should
[b972eaf] Remove unrequired element
[0ffa28a] Ease maintenance and readability
[4690169] Fix as per broken tests
[a1371c6] Merge setup-erlang in
2021-03-30 11:54:20 -05:00
Bryan Paxton b9b3074680 Change occurences of actions/setup-elixir to erlef/setup-elixir (#2)
* Change all occurrences of actions/setup-elixir to erlef/setup-elixir
2021-01-19 15:20:06 -06:00
Eric Meadows-Jönsson 4edd0cd12d Install OTP branches 2021-01-12 02:21:05 +00:00
Jonathan Clem 36fa5b27cc Merge pull request #42 from actions/unit-tests
Add basic unit tests for semver matching
2020-09-16 15:11:29 -04:00
Jonathan Clem c59c7ac8b6 Add pre-releases to integration tests 2020-09-16 14:58:19 -04:00