Skip to content

Commit c70194e

Browse files
authored
Add local-lib for easy caching (#28)
* Performing change #24 by @quarckster * Upgrading to stave off #23 and follow #22 * Changing URLs * ♻️ #22 #23 #25 * Setting up #2 Although the environment variable part is going to be a bit harder * Implementing env var #2 * #2 testing * Working well, but let's see the variables * Local lib needs false sudo * Let's see what it's doing... * Adding linting. Quality is important * Change name and branding * I guess that does not apply * Fixed eslint error * Change to equivalent input variable * Rewrite config with new version * Solving the config issue * use CommonJS config
1 parent c948323 commit c70194e

File tree

9 files changed

+26056
-8041
lines changed

9 files changed

+26056
-8041
lines changed

.github/workflows/check.yml

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
2-
name: check
1+
name: Check workflow
32

4-
on: [push]
3+
on: [push, pull_request]
54

65
jobs:
76
cpanm:
@@ -158,3 +157,20 @@ jobs:
158157
# checking that both modules are installed
159158
- run: perl -Mabbreviation -e1
160159
- run: perl -MACH -e1
160+
161+
## ------------------------------------------------
162+
## test with local-lib
163+
## ------------------------------------------------
164+
local_lib:
165+
runs-on: ubuntu-latest
166+
name: 'local-lib'
167+
168+
steps:
169+
- uses: actions/checkout@v4
170+
- name: 'install-with-cpanm'
171+
uses: ./
172+
with:
173+
install: 'Simple::Accessor'
174+
local-lib: '~/perl5'
175+
sudo: false
176+
args: '-v'

.github/workflows/lint-javascript.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint javascript
2+
on:
3+
push:
4+
paths:
5+
- '*.js'
6+
- '.github/workflows/lint-javascript.yml'
7+
- 'eslint.config.js'
8+
- 'package*'
9+
pull_request:
10+
paths:
11+
- '*.js'
12+
- '.github/workflows/lint-javascript.yml'
13+
- 'eslint.config.js'
14+
- 'package*'
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Install dependencies
21+
run: npm ci
22+
- name: Lint javascript
23+
run: npm run lint

README.md

+45-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Actions Status](https://github.com/perl-actions/install-with-cpanm/workflows/check/badge.svg)](https://github.com/perl-actions/install-with-cpanm/actions)
1+
[![Actions Status](https://github.com/perl-actions/install-with-cpanm/workflows/check/badge.svg)](https://github.com/perl-actions/install-with-cpanm/actions) [![Lint javascript](https://github.com/perl-actions/install-with-cpanm/actions/workflows/lint-javascript.yml/badge.svg)](https://github.com/perl-actions/install-with-cpanm/actions/workflows/lint-javascript.yml)
22

33
# install-with-cpanm
44

@@ -8,7 +8,7 @@ This action installs 'cpanminus' then use it if needed to install some Perl Modu
88

99
```yaml
1010
- name: install cpanm and multiple modules
11-
uses: perl-actions/install-with-cpanm@stable
11+
uses: perl-actions/install-with-cpanm@v1
1212
with:
1313
install: |
1414
Simple::Accessor
@@ -22,6 +22,8 @@ This action installs 'cpanminus' then use it if needed to install some Perl Modu
2222
# path: "$Config{installsitescript}/cpanm"
2323
# which perl binary to use
2424
# perl: 'perl'
25+
# Use a local library
26+
# local-lib: ~/perl5
2527
```
2628

2729
## Using install-with-cpanm in a GitHub workflow
@@ -53,7 +55,7 @@ jobs:
5355
steps:
5456
- uses: actions/checkout@v4
5557
- name: uses install-with-cpanm
56-
uses: perl-actions/install-with-cpanm@stable
58+
uses: perl-actions/install-with-cpanm@v1
5759
with:
5860
cpanfile: "cpanfile"
5961
sudo: false
@@ -113,6 +115,11 @@ By setting PATH correctly you probably do not need to use it.
113115
Where to install `cpanm`. Default value is `$Config{installsitescript}/cpanm`.
114116
You can use any `$Config` variable in your string.
115117

118+
### `local-lib`
119+
120+
Local (user space) library where `cpanm` will install the distributions. Use
121+
this for caching, for instance.
122+
116123
## Outputs
117124

118125
none
@@ -199,3 +206,38 @@ windows:
199206
- run: perl -Mabbreviation -e1
200207
- run: perl -MACH -e1
201208
```
209+
210+
### Using install-with-cpanm for installation in local library
211+
212+
```yaml
213+
local_lib:
214+
runs-on: ubuntu-latest
215+
name: 'local-lib'
216+
217+
steps:
218+
- uses: actions/checkout@v4
219+
- name: 'install-with-cpanm'
220+
uses: ./
221+
with:
222+
install: 'Simple::Accessor'
223+
local-lib: '~/perl5'
224+
sudo: false
225+
verbose: true
226+
```
227+
228+
229+
## License
230+
231+
Copyright (c) 2022-2024, Atoomic, Olaf Alders, haarg, Brian C. Arnold, mohawk2
232+
233+
Permission to use, copy, modify, and/or distribute this software for any
234+
purpose with or without fee is hereby granted, provided that the above
235+
copyright notice and this permission notice appear in all copies.
236+
237+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
238+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
239+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
240+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
241+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
242+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
243+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

action.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: "install with cpanm"
1+
name: "install with cpanm action"
22
description: "install Perl Modules with App::cpanminus"
33
branding:
4-
icon: "arrow-right"
4+
icon: "arrow-down"
55
color: "blue"
66

77
inputs:
@@ -42,6 +42,10 @@ inputs:
4242
required: false
4343
default: "$Config{installsitescript}/cpanm"
4444

45+
local-lib:
46+
description: "Path where to install modules"
47+
required: false
48+
4549
runs:
4650
using: "node20"
4751
main: "dist/index.js"

0 commit comments

Comments
 (0)