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

Fatpack cpanm and carton #54

Merged
merged 16 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions .github/workflows/darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,13 @@ jobs:
- name: gcc --version
run: gcc --version

- name: install Carton
shell: bash
run: "curl -sSL https://cpanmin.us | perl - --notest --sudo Carton"
working-directory: ./scripts/darwin

- uses: actions/cache@v1
with:
path: scripts/darwin/local
key: ${{ runner.os }}-build-${{ hashFiles('scripts/linux/cpanfile.snapshot') }}
- name: carton install --deployment
shell: bash
run: carton install --deployment
run: ../../bin/carton install --deployment
working-directory: ./scripts/darwin

- name: build
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,13 @@ jobs:
- name: gcc --version
run: gcc --version

- name: install Carton
shell: bash
run: "curl -sSL https://cpanmin.us | perl - --notest --sudo Carton"
working-directory: ./scripts/linux

- uses: actions/cache@v1
with:
path: scripts/linux/local
key: ${{ runner.os }}-build-${{ hashFiles('scripts/linux/cpanfile.snapshot') }}
- name: carton install --deployment
shell: bash
run: carton install --deployment
run: ../../bin/carton install --deployment
working-directory: ./scripts/linux

- name: build
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ jobs:
with:
node-version: 12.x

- name: npm install
run: npm install
- run: npm install
- run: npm run build
- run: npm test

- name: Lint
run: npm run format-check
- name: use the action
uses: ./
- run: perl -V

- name: npm test
run: npm test
- run: npm run format-check
21 changes: 3 additions & 18 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v1

- name: install Carton
shell: bash
run: curl -sSL https://cpanmin.us | perl - --notest --sudo Carton
working-directory: ./scripts/linux

- name: carton install
shell: bash
run: |
rm -f cpanfile.snapshot
carton install
../../bin/carton install
working-directory: ./scripts/linux

- uses: actions/upload-artifact@v1
Expand All @@ -34,16 +29,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v1

- name: install Carton
shell: bash
run: "curl -sSL https://cpanmin.us | perl - --notest --sudo Carton"
working-directory: ./scripts/darwin

- name: carton install
shell: bash
run: |
rm -f cpanfile.snapshot
carton install
../../bin/carton install
working-directory: ./scripts/darwin

- uses: actions/upload-artifact@v1
Expand All @@ -64,14 +54,9 @@ jobs:
- run: "rm -f scripts/windows/cpanfile.snapshot"
shell: bash

- name: install Carton
shell: cmd
run: cpanm --notest Carton
working-directory: ./scripts/windows

- name: carton install
shell: cmd
run: carton install
run: ..\..\bin\carton install
working-directory: ./scripts/windows

- uses: actions/upload-artifact@v1
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,13 @@ jobs:
- name: gcc --version
run: gcc --version

- name: install Carton
shell: cmd
run: cpanm --notest Carton
working-directory: ./scripts/windows

- uses: actions/cache@v1
with:
path: scripts/windows/local
key: ${{ runner.os }}-build-${{ hashFiles('scripts/linux/cpanfile.snapshot') }}
- name: carton install
shell: cmd
run: carton install
run: ../../bin/carton install
working-directory: ./scripts/windows

- name: build
Expand Down
1 change: 1 addition & 0 deletions author/carton/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/local/
4 changes: 4 additions & 0 deletions author/carton/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/local/
/carton
/carton.bat
/.image.exists
10 changes: 10 additions & 0 deletions author/carton/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:latest

# build perl
RUN apk add --no-cache gcc libc-dev curl perl patch make wget && \
curl --compressed -sSL https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build | perl - 5.8.8 /opt/perl-5.8/ && \
# do not remove gcc and libc-dev because some cpan modules need them
apk del perl patch

ENV PATH=/opt/perl-5.8/bin:$PATH
RUN curl --compressed -sSL https://cpanmin.us/ | perl - --notest App::FatPacker::Simple Carton ExtUtils::PL2Bat
41 changes: 41 additions & 0 deletions author/carton/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
help: ## show this text
# from http://postd.cc/auto-documented-makefile/
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

IMAGE_NAME = carton-packer
DOCKER_RUN = docker run --rm -v $(PWD):/tmp/carton -w /tmp/carton $(IMAGE_NAME)

.PHONY: all
all: carton carton.bat

.PHONY: image
image: .image.exists ## build docker image of packing environment
.image.exists:
docker build -t $(IMAGE_NAME) .
touch .image.exists

carton: .image.exists local/bin/carton build.pl ## generate fat-packed carton
$(DOCKER_RUN) perl build.pl
chmod +w carton

carton.bat: .image.exists carton
$(DOCKER_RUN) perl -MExtUtils::PL2Bat -e 'pl2bat(in=>"carton")'

local/bin/carton: .image.exists cpanfile.snapshot
$(DOCKER_RUN) carton install --deployment

.PHONY: update
update: .image.exists ## download dependencies and update cpanfile.snapshot
rm -f cpanfile.snapshot
$(DOCKER_RUN) carton install

.PHONY: install
install: all ## installs into the bin directory of this repository
cp carton ../../bin/
cp carton.bat ../../bin/

.PHONY: clean
clean:
rm -rf local/
rm -f carton carton.bat .image.exists
docker rmi $(IMAGE_NAME)
31 changes: 31 additions & 0 deletions author/carton/build.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env perl

use strict;
use warnings;
use FindBin;
use App::FatPacker::Simple;
use Carton::Snapshot;

sub fatpack {
App::FatPacker::Simple->new->parse_options(@_)->run
}

fatpack(
"-o", "carton",
"-d", "local",
"-e", join(
',',
# configure modules
'ExtUtils::MakeMaker', 'Module::Build',
# test modules
'Test2,App::Prove','TAP::Harness',
# core modules of perl 5
'Cwd',
# XS modules
'Devel::GlobalDestruction::XS','Class::C3::XS',
# the Carton does not use Path::Tiny->digest, so we can remove it
'Digest::SHA'
),
"--shebang", '#!/usr/bin/env perl',
"local/bin/carton"
);
6 changes: 6 additions & 0 deletions author/carton/cpanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
requires 'perl', '5.008005';

requires 'Carton';
requires 'Menlo::Legacy';
requires 'Menlo';
requires 'Menlo::Index::Mirror';
Loading