Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Sep 13, 2024
0 parents commit d130ac4
Show file tree
Hide file tree
Showing 20 changed files with 29,945 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_size = 2
charset = utf-8
indent_style = space
end_of_line = lf
insert_final_newline = true
18 changes: 18 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: check

on: [push]

jobs:
META.json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run lint
- run: npm run test
- id: get-prereqs
uses: ./
working-directory: test/corpus
- run: echo $PREREQS
env:
PREREQS: ${{ steps.get-prereqs.prereqs }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# install-with-cpanm

GitHub action to get prerequisites for a local CPAN distribution.

```yaml
- id: get-prereqs
name: Get prerequisites
uses: perl-actions/get-prereqs@v1
- name: Install prerequisites
uses: perl-actions/install-with-cpanm@v1
with:
install: ${{ steps.get-prereqs.prereqs }}
```
## Inputs
### `phases`

List of phases to get prerequsites for, as defined in
[CPAN::Meta::Spec](https://metacpan.org/pod/CPAN::Meta::Spec#Phases).

Defaults to `build test runtime`.

### `relationships`

List of relationships to get prerequsites for, as defined in
[CPAN::Meta::Spec](https://metacpan.org/pod/CPAN::Meta::Spec#Relationships).

Defaults to `requires`.

### `features`

List of optional features to include prequisites for, as defined in
[CPAN::Meta::Spec](https://metacpan.org/pod/CPAN::Meta::Spec#optional_features).

Defaults to none.

### `sources`

List of files to search for prerequisites. Supported formats are:

* [META files](https://metacpan.org/pod/CPAN::Meta::Spec) in JSON and YAML
formats.
* [`cpmfile`](https://metacpan.org/pod/Module::cpmfile) in JSON and YAML
formats.
* [`cpanfile`](https://metacpan.org/dist/Module-CPANfile/view/lib/cpanfile.pod)
files as generated by [Module::CPANfile](https://metacpan.org/pod/Module::CPANfile)
or [Dist::Zilla::Plugin::CPANFile](https://metacpan.org/pod/Dist::Zilla::Plugin::CPANFile).
These files are parsed statically, files doing dynamic checks will not be
supported. These files must be named `cpanfile`.
* [Prereqs File](https://metacpan.org/pod/Dist::Zilla::Plugin::PrereqsFile)
in JSON and YAML formats. These files must named `prereqs.yml` or
`prereqs.json`.
* `Makefile` as emitted by
[ExtUtils::MakeMaker](https://metacpan.org/pod/ExtUtils::MakeMaker). This
was used to communicated dependencies before `MYMETA` files were invented.



Defaults to `MYMETA.json MYMETA.yml META.json META.yml Makefile cpanfile`.

## Outputs

### `perl`

The perl version declared as a prerequisite. Formatted like `v5.30`.

### `prereqs`

The prerequisites declared including the required versions, formatted as
expected by `cpanm` or `cpm`.

### `prereqs-no-version`

The prerequisites declared, not including the required versions.

### `prereqsJSON`

The prerequisites declared, formatted as a JSON string. The keys of the object
will be the module name, and the values will be the versions required.
37 changes: 37 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Get Prereqs from Dist"
description: "Extracts the prereqs from a local dist"
branding:
icon: "arrow-right"
color: "blue"

inputs:
phases:
description: "The phases to get prerequisites for"
required: false
default: "build test runtime"
relationships:
description: "The relationships to get prerequisites for"
required: false
default: "requires"
features:
description: "The optional features to get prerequisites for"
required: false
default: ""
sources:
description: "Source files to check for prerequisites"
required: false
default: "MYMETA.json MYMETA.yml META.json META.yml Makefile cpanfile"

outputs:
perl:
description: "The prerequisites formatted with a version in the syntax expected by cpanm or cpm"
prereqs:
description: "The prerequisites formatted with a version in the syntax expected by cpanm or cpm"
prereqs:
description: "The prerequisites formatted without a version as expected by CPAN.pm"
prereqsJSON:
description: "The prerequisites as a JSON string with modules as the keys and versions as the values"

runs:
using: "node20"
main: "dist/main.js"
Loading

0 comments on commit d130ac4

Please sign in to comment.