Skip to content

Commit

Permalink
Add local-lib for easy caching (#28)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
JJ authored Apr 8, 2024
1 parent c948323 commit c70194e
Show file tree
Hide file tree
Showing 9 changed files with 26,056 additions and 8,041 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: check
name: Check workflow

on: [push]
on: [push, pull_request]

jobs:
cpanm:
Expand Down Expand Up @@ -158,3 +157,20 @@ jobs:
# checking that both modules are installed
- run: perl -Mabbreviation -e1
- run: perl -MACH -e1

## ------------------------------------------------
## test with local-lib
## ------------------------------------------------
local_lib:
runs-on: ubuntu-latest
name: 'local-lib'

steps:
- uses: actions/checkout@v4
- name: 'install-with-cpanm'
uses: ./
with:
install: 'Simple::Accessor'
local-lib: '~/perl5'
sudo: false
args: '-v'
23 changes: 23 additions & 0 deletions .github/workflows/lint-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint javascript
on:
push:
paths:
- '*.js'
- '.github/workflows/lint-javascript.yml'
- 'eslint.config.js'
- 'package*'
pull_request:
paths:
- '*.js'
- '.github/workflows/lint-javascript.yml'
- 'eslint.config.js'
- 'package*'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Lint javascript
run: npm run lint
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Actions Status](https://github.com/perl-actions/install-with-cpanm/workflows/check/badge.svg)](https://github.com/perl-actions/install-with-cpanm/actions)
[![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)

# install-with-cpanm

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

```yaml
- name: install cpanm and multiple modules
uses: perl-actions/install-with-cpanm@stable
uses: perl-actions/install-with-cpanm@v1
with:
install: |
Simple::Accessor
Expand All @@ -22,6 +22,8 @@ This action installs 'cpanminus' then use it if needed to install some Perl Modu
# path: "$Config{installsitescript}/cpanm"
# which perl binary to use
# perl: 'perl'
# Use a local library
# local-lib: ~/perl5
```

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

### `local-lib`

Local (user space) library where `cpanm` will install the distributions. Use
this for caching, for instance.

## Outputs

none
Expand Down Expand Up @@ -199,3 +206,38 @@ windows:
- run: perl -Mabbreviation -e1
- run: perl -MACH -e1
```

### Using install-with-cpanm for installation in local library

```yaml
local_lib:
runs-on: ubuntu-latest
name: 'local-lib'
steps:
- uses: actions/checkout@v4
- name: 'install-with-cpanm'
uses: ./
with:
install: 'Simple::Accessor'
local-lib: '~/perl5'
sudo: false
verbose: true
```


## License

Copyright (c) 2022-2024, Atoomic, Olaf Alders, haarg, Brian C. Arnold, mohawk2

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "install with cpanm"
name: "install with cpanm action"
description: "install Perl Modules with App::cpanminus"
branding:
icon: "arrow-right"
icon: "arrow-down"
color: "blue"

inputs:
Expand Down Expand Up @@ -42,6 +42,10 @@ inputs:
required: false
default: "$Config{installsitescript}/cpanm"

local-lib:
description: "Path where to install modules"
required: false

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

0 comments on commit c70194e

Please sign in to comment.