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

add install-modules option #686

Merged
merged 28 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
efb30a1
add `install-modules` option
shogo82148 May 4, 2021
cee019e
implement installing with cpanm
shogo82148 May 4, 2021
f18a892
install extra modules
shogo82148 May 4, 2021
eb163ac
add working-directory option
shogo82148 May 4, 2021
14c230b
add tests for instaling CPAN modules
shogo82148 May 4, 2021
2e6339c
fix the name of option
shogo82148 May 5, 2021
73fced2
move the test to another workflow
shogo82148 May 5, 2021
29cc15a
fix the name of steps
shogo82148 May 5, 2021
3af6e15
configure environment values
shogo82148 May 5, 2021
6c6c70d
set full path for cpanm
shogo82148 May 5, 2021
a301c7c
trim module names
shogo82148 May 5, 2021
506c16c
install App::a2p instead of Module::CPANfile
shogo82148 May 5, 2021
f931d5e
fix module name
shogo82148 May 5, 2021
059e424
add installers to the build matrix
shogo82148 May 5, 2021
0b30431
fix the name of the workflow
shogo82148 May 5, 2021
f043857
enable caching npm modules
shogo82148 May 5, 2021
5b8f567
fix the job name
shogo82148 May 5, 2021
0a5fc7a
save cache
shogo82148 May 5, 2021
4d6e0aa
implement installing with cpm
shogo82148 May 5, 2021
85ecff1
bump cache version
shogo82148 May 5, 2021
51bfb71
implement installWithCarton
shogo82148 May 5, 2021
7099d7c
use perl installed
shogo82148 May 5, 2021
7e2641d
add missing await
shogo82148 May 5, 2021
225e760
add --show-build-log-on-failure option
shogo82148 May 5, 2021
d60fa31
specify env
shogo82148 May 5, 2021
bd49ab0
skip test of old perl
shogo82148 May 5, 2021
83b161f
Merge branch 'main' into introduce-cache-options
shogo82148 May 5, 2021
84fe7fe
check whether cpanfile exists
shogo82148 May 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/test-cpan-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CPAN installer
on:
pull_request:
paths:
- "bin/cpanm"
- "bin/cpm"
- "bin/carton"
- "__test__/**"
- "src/**"
- "package.json"
- "package-lock.json"
- "action.yml"
push:
branches:
- "main"
workflow_dispatch:

jobs:
installer:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
installer:
- cpanm
- cpm
- carton
perl:
- "5" # latest version of Perl 5

# TODO: fix cpm
# - "5.8.1" # oldest version the original cpanm supports
# TODO: @shogo82148 fix me
# building ExtUtils::MakeMaker fails.
# - "5.8.0"
# TODO: fix cpm
# - "5.6.2"
# - "5.6.1" # oldest version the action supports
# too old to work cpanm... I gave up.
# - "5.6.0"
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- run: npm run build
- run: npm run package

- name: use the action
uses: ./
with:
perl-version: "${{ matrix.perl }}"
install-modules-with: "${{ matrix.installer }}"
install-modules: |
ExtUtils::MakeMaker
working-directory: __test__/p5-Test-Module
- name: print the version of App::a2p and use it
run: |
perl -MApp::a2p -e 'print $App::a2p::VERSION'
echo '$1' | a2p

- name: print the version of ExtUtils::MakeMaker
run: |
perl -MExtUtils::MakeMaker -e 'print $ExtUtils::MakeMaker::VERSION'

- run: ${{ matrix.installer }} --help
- run: ${{ matrix.installer }} --version
49 changes: 0 additions & 49 deletions .github/workflows/test-cpanm.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Main workflow
on:
pull_request:
paths:
- "__test__/**"
- "src/**"
- "package.json"
- "package-lock.json"
Expand Down Expand Up @@ -34,6 +35,17 @@ jobs:
with:
node-version: 12.x

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- run: npm run build
- run: npm run package
Expand Down Expand Up @@ -107,6 +119,17 @@ jobs:
with:
node-version: 12.x

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- run: npm run build
- run: npm run package
Expand Down Expand Up @@ -182,6 +205,17 @@ jobs:
with:
node-version: 12.x

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- run: npm run build
- run: npm run package
Expand Down Expand Up @@ -257,6 +291,17 @@ jobs:
with:
node-version: 12.x

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm ci
- run: npm run build
- run: npm run package
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/node_modules/
/lib/
/__test__/runner/
local/
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ steps:
- uses: actions/checkout@v2
- uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.30'
perl-version: '5.32'
distribution: strawberry
- run: cpanm --installdeps .
- run: prove -lv t
Expand All @@ -66,7 +66,7 @@ This option is available on Windows and falls back to the default customized bin
The action works for [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners).

| Operating System | Supported Versions |
| --- | --- | --- |
| --- | --- |
| Linux | `ubuntu-18.04`, `ubuntu-20.04` |
| macOS | `macos-10.05`, `macos-11.0` |
| Windows | `windows-2019` |
Expand All @@ -82,6 +82,10 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| `perl-version` | Specifies the Perl version to setup. Minor version and patch level can be omitted. The action uses the latest Perl version available that matches the specified value. This defaults to `5`, which results in the latest available version of Perl 5. In addition, the value `latest` is available, the actions uses the latest available version of Perl including `5`, `7` or later major versions. | `5` |
| `distribution` | Specify the distribution to use, this is either `default` or `strawberry`. (The value `strawberry` is ignored on anything but Windows.) | `default` |
| `multi-thread` | Enables interpreter-based threads (ithread) options (-Duseithreads). "true" and "false" are accepted. On Linux and macOS, the default value is "false" (ithread is disabled). On Windows, the default value is "true" (ithread is enable) for fork emulation. | depends on platform |
| `install-modules-with`| install CPAN modules from your `cpanfile` with the specified installer. `cpanm`([App::cpanminus](https://metacpan.org/pod/App::cpanminus)), `cpm`([App::cpm](https://metacpan.org/pod/App::cpm)), and `carton`([Carton](https://metacpan.org/pod/Carton)) are available. By default, any CPAN modules are not installed. | Nothing |
| `install-modules` | List of one or more CPAN modules, separated by a newline `\n` character. | Nothing |
| `enable-modules-cache` | enable caching when install CPAN modules. | `true` |
| `working-directory` | description: working directory. | `.` |

# Supported Shells

Expand Down
1 change: 1 addition & 0 deletions __test__/p5-Test-Module/cpanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requires 'App::a2p';
23 changes: 22 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,40 @@ inputs:
perl-version:
description: "The Perl version to download (if necessary) and use. Example: 5.30.0"
default: "5"
required: false
distribution:
description: |
The distribution of Perl binary.
"default" and "strawberry" are accepted.
"default" is the custom binaries for actions-setup-perl. It is available on Linux, macOS, and Windows.
"strawberry" is from http://strawberryperl.com/ . It is available on Windows and falls back to default on other platform.
default: "default"
required: false
multi-thread:
description: |
enables multi threading options(-Duseshrplib -Duseithreads).
enables multi threading options(-Duseithreads).
"true" and "false" are accepted.
On Linux and macOS, the default value is false (multi threading is disabled).
On Windows, this option is ignored, multi-threading is always enabled.
required: false
install-modules-with:
description: |
install CPAN modules from your cpanfile with the specified installer.
cpanm(App::cpanminus), cpm(App::cpm), and carton(Carton) are available.
By default, any CPAN modules are not installed.
required: false
install-modules:
description: |
List of one or more CPAN modules, separated by a newline \n character.
required: false
enable-modules-cache:
description: enable caching when install CPAN modules.
default: true
required: false
working-directory:
description: working directory.
default: "."
required: false
runs:
using: "node12"
main: "dist/index.js"
Expand Down
Loading