improve _load_valid_user_project_config_with_default #158
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions CI script for Perl-Dist-APPerl | |
# (C) 2022 Gavin Hayes | |
name: Build Actually Portable Perl | |
on: [ push, pull_request ] | |
jobs: | |
build-linux: | |
name: Build Perl-Dist-APPerl | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch repo | |
uses: actions/checkout@v3 | |
with: | |
path: 'Perl-Dist-APPerl' | |
- name: Install Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: '5.36' | |
install-modules-with: cpanm | |
install-modules: File::ShareDir::Install | |
- name: Test in-tree | |
run: | | |
cd Perl-Dist-APPerl | |
prove -lv t | |
- name: Build Perl-Dist-APPerl release | |
run: | | |
cd Perl-Dist-APPerl | |
perl Makefile.PL | |
make manifest | |
make dist | |
mv Perl-Dist-APPerl-v*.tar.gz ../ | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cpan | |
if-no-files-found: error | |
path: Perl-Dist-APPerl-v*.tar.gz | |
build-apperl: | |
name: Build perl.com | |
runs-on: ubuntu-latest | |
needs: build-linux | |
strategy: | |
matrix: | |
config: [full, small, full-vista, small-vista] | |
steps: | |
- name: Fetch build artifacts | |
uses: actions/download-artifact@v3 | |
- name: prepare for installing module | |
run: | | |
mv cpan/Perl-Dist-APPerl-v*.tar.gz Perl-Dist-APPerl.tar.gz | |
- name: Install Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: '5.36' | |
install-modules-with: cpanm | |
install-modules: Perl-Dist-APPerl.tar.gz | |
- name: Load config | |
run: | | |
echo "PERL_ID=$(apperlm get-config-key ${{ matrix.config }} perl_id)" >> $GITHUB_ENV | |
echo "COSMO_ID=$(apperlm get-config-key ${{ matrix.config }} cosmo_id)" >> $GITHUB_ENV | |
echo "DEST_BIN=$(apperlm get-config-key ${{ matrix.config }} dest)" >> $GITHUB_ENV | |
echo "REL_NAME=APPerl-$(perl -MPerl::Dist::APPerl -e 'print $Perl::Dist::APPerl::VERSION')-${{ matrix.config }}.zip" >> $GITHUB_ENV | |
- name: Fetch Perl fork | |
uses: actions/checkout@v3 | |
with: | |
repository: 'G4Vi/perl5' | |
ref: ${{ env.PERL_ID }} | |
path: 'perl5' | |
- name: Fetch cosmopolitan | |
uses: actions/checkout@v3 | |
with: | |
repository: 'jart/cosmopolitan' | |
ref: ${{ env.COSMO_ID }} | |
path: 'cosmopolitan' | |
- name: support ape bins | |
run: sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" | |
- name: Configure and Build perl.com | |
env: | |
CF_BY: ${{ secrets.CF_BY }} | |
CF_EMAIL: ${{ secrets.CF_EMAIL }} | |
run: | | |
ls -la | |
apperlm install-build-deps -p perl5 -c cosmopolitan | |
apperlm init --name ${{ matrix.config }} | |
apperlm list | |
apperlm configure -Dcf_by="$CF_BY" -Dcf_email="$CF_EMAIL" | |
apperlm build | |
zip -r ${{ env.REL_NAME }} ${{ env.DEST_BIN }} ${{ env.DEST_BIN }}.dbg | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.config }} | |
if-no-files-found: error | |
path: | | |
${{ env.DEST_BIN }} | |
${{ env.DEST_BIN }}.dbg | |
${{ env.REL_NAME }} | |
test-Perl-Dist-APPerl: | |
name: test Perl-Dist-APPerl | |
runs-on: ubuntu-latest | |
needs: build-apperl | |
strategy: | |
matrix: | |
version: ['5.10', '5.36'] | |
steps: | |
- name: Fetch repo | |
uses: actions/checkout@v3 | |
with: | |
path: 'Perl-Dist-APPerl' | |
- name: Install Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: ${{ matrix.version }} | |
install-modules-with: cpanm | |
install-modules: B::Keywords HTTP::Tiny Test::Pod::LinkCheck::Lite | |
- name: download build artifacts | |
uses: actions/download-artifact@v3 | |
- name: Setup for tests | |
run: | | |
cd Perl-Dist-APPerl | |
cpanm --installdeps --notest . | |
mv ../full/perl.com* ./ | |
chmod +x perl.com | |
mv ../small/perl-small.com* ./ | |
mv ../full-vista/perl-vista.com* ./ | |
mv ../small-vista/perl-small-vista.com* ./ | |
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" | |
- name: Run tests | |
run: | | |
cd Perl-Dist-APPerl | |
perl Makefile.PL | |
make | |
make authortest | |
- name: Archive CPAN logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cpan_log | |
path: /home/runner/.cpanm/work/*/build.log | |
test-nobuild-builds: | |
name: Test building nobuild configs | |
needs: build-apperl | |
strategy: | |
matrix: | |
os: [ubuntu-latest] #, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Fetch build artifacts | |
uses: actions/download-artifact@v3 | |
- name: support ape bins | |
run: sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" | |
- name: Try nobuild build | |
run: | | |
mkdir src | |
cp full/perl.com src/ | |
chmod +x src/perl.com | |
src/perl.com /zip/bin/apperlm list | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: [ build-linux, build-apperl, test-Perl-Dist-APPerl, test-nobuild-builds ] | |
steps: | |
- name: Fetch build artifacts | |
if: ${{ github.ref_type == 'tag' }} | |
uses: actions/download-artifact@v3 | |
- name: Build binary amalgamation for uploading to microsoft | |
if: ${{ github.ref_type == 'tag' }} | |
run: | | |
sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" | |
chmod +x full/perl.com | |
REL_NAME=APPerl-$(full/perl.com -MPerl::Dist::APPerl -e 'print $Perl::Dist::APPerl::VERSION')-all.zip | |
zip -r $REL_NAME */*.com* | |
- name: Publish release | |
if: ${{ github.ref_type == 'tag' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
draft: true | |
files: | | |
cpan/Perl-Dist-APPerl-v*.tar.gz | |
full/* | |
small/* | |
full-vista/* | |
small-vista/* | |
APPerl-*-all.zip |