|
| 1 | +name: Test |
| 2 | +on: |
| 3 | + push: ~ |
| 4 | + pull_request: ~ |
| 5 | + |
| 6 | +jobs: |
| 7 | + perl-versions: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + name: Calculate Perl Versions |
| 10 | + outputs: |
| 11 | + versions: ${{ steps.perl-versions.outputs.perl-versions }} |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Extract perl dependecy |
| 15 | + id: prereqs |
| 16 | + uses: perl-actions/get-prereqs@v1 |
| 17 | + with: |
| 18 | + sources: prereqs.yml |
| 19 | + - id: perl-versions |
| 20 | + uses: perl-actions/perl-versions@v1 |
| 21 | + with: |
| 22 | + since-perl: ${{ steps.prereqs.outputs.perl }} |
| 23 | + with-devel: true |
| 24 | + |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: ~/.perl-cpm |
| 32 | + key: cpm-${{ runner.os }} |
| 33 | + - name: Setup local::lib |
| 34 | + run: | |
| 35 | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" |
| 36 | + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" |
| 37 | + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 38 | + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 39 | + - name: Extract Dist::Zilla dependencies |
| 40 | + id: authordeps |
| 41 | + uses: perl-actions/get-prereqs@v1 |
| 42 | + with: |
| 43 | + sources: dist.ini |
| 44 | + phases: author |
| 45 | + exclude: Dist::Zilla::Plugin::Test::Pod::Coverage::TrustMe |
| 46 | + - name: Install authordeps |
| 47 | + uses: perl-actions/install-with-cpm@v1 |
| 48 | + with: |
| 49 | + sudo: false |
| 50 | + install: ${{ steps.authordeps.outputs.prereqs }} |
| 51 | + - name: Build |
| 52 | + id: build |
| 53 | + run: | |
| 54 | + DZIL_COLOR=1 dzil build --no-tgz | tee "/tmp/dzil-build.log" |
| 55 | + echo build="$(grep --only-matching 'built in .*' "/tmp/dzil-build.log" | tail -1 | cut -c10-)" >> "$GITHUB_OUTPUT" |
| 56 | + - name: Upload build |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: ${{ steps.build.outputs.build }} |
| 60 | + path: ${{ steps.build.outputs.build }} |
| 61 | + include-hidden-files: true |
| 62 | + outputs: |
| 63 | + name: ${{ steps.build.outputs.build }} |
| 64 | + |
| 65 | + test: |
| 66 | + needs: |
| 67 | + - perl-versions |
| 68 | + - build |
| 69 | + |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + perl-version: ${{ fromJson(needs.perl-versions.outputs.versions) }} |
| 74 | + |
| 75 | + runs-on: ubuntu-latest |
| 76 | + container: |
| 77 | + image: perl:${{ matrix.perl-version }}-buster |
| 78 | + |
| 79 | + env: |
| 80 | + AUTOMATED_TESTING: 1 |
| 81 | + PERL_USE_UNSAFE_INC: 0 |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Download build |
| 85 | + uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + name: ${{ needs.build.outputs.name }} |
| 88 | + - uses: actions/cache@v4 |
| 89 | + with: |
| 90 | + path: ~/.perl-cpm |
| 91 | + key: cpm-perl:${{ matrix.perl-version }}-buster |
| 92 | + - name: Setup local::lib |
| 93 | + run: | |
| 94 | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" |
| 95 | + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" |
| 96 | + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 97 | + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 98 | + - name: Extract configure dependecies |
| 99 | + id: configure |
| 100 | + uses: perl-actions/get-prereqs@v1 |
| 101 | + with: |
| 102 | + phases: configure |
| 103 | + - name: Install configure deps |
| 104 | + uses: perl-actions/install-with-cpm@v1 |
| 105 | + with: |
| 106 | + sudo: false |
| 107 | + install: ${{ steps.configure.outputs.prereqs }} |
| 108 | + - name: Run Makefile.PL |
| 109 | + run: perl Makefile.PL |
| 110 | + - name: Extract dependecies |
| 111 | + id: prereqs |
| 112 | + uses: perl-actions/get-prereqs@v1 |
| 113 | + with: |
| 114 | + phases: build test runtime |
| 115 | + relationships: requires recommends suggests |
| 116 | + - name: Install deps |
| 117 | + uses: perl-actions/install-with-cpm@v1 |
| 118 | + with: |
| 119 | + sudo: false |
| 120 | + install: ${{ steps.prereqs.outputs.prereqs }} |
| 121 | + - name: Run the tests |
| 122 | + run: make test |
| 123 | + env: |
| 124 | + AUTHOR_TESTING: 1 |
| 125 | + |
| 126 | + test-xt: |
| 127 | + needs: |
| 128 | + - perl-versions |
| 129 | + - build |
| 130 | + |
| 131 | + runs-on: ubuntu-latest |
| 132 | + container: |
| 133 | + image: perl:5.36-buster |
| 134 | + |
| 135 | + env: |
| 136 | + AUTOMATED_TESTING: 1 |
| 137 | + |
| 138 | + steps: |
| 139 | + - name: Download build |
| 140 | + uses: actions/download-artifact@v4 |
| 141 | + with: |
| 142 | + name: ${{ needs.build.outputs.name }} |
| 143 | + - uses: actions/cache@v4 |
| 144 | + with: |
| 145 | + path: ~/.perl-cpm |
| 146 | + key: cpm-perl:5.36-buster |
| 147 | + - name: Setup local::lib |
| 148 | + run: | |
| 149 | + echo "$RUNNER_TEMP/perl5/bin" >> "$GITHUB_PATH" |
| 150 | + echo "PERL5LIB=$RUNNER_TEMP/perl5/lib/perl5:$PERL5LIB" >> "$GITHUB_ENV" |
| 151 | + echo "PERL_MB_OPT=--install_base $RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 152 | + echo "PERL_MM_OPT=INSTALL_BASE=$RUNNER_TEMP/perl5" >> "$GITHUB_ENV" |
| 153 | + - name: Extract configure dependecies |
| 154 | + id: configure |
| 155 | + uses: perl-actions/get-prereqs@v1 |
| 156 | + with: |
| 157 | + phases: configure |
| 158 | + - name: Install configure deps |
| 159 | + uses: perl-actions/install-with-cpm@v1 |
| 160 | + with: |
| 161 | + sudo: false |
| 162 | + install: ${{ steps.configure.outputs.prereqs }} |
| 163 | + - name: Run Makefile.PL |
| 164 | + run: perl Makefile.PL |
| 165 | + - name: Extract dependecies |
| 166 | + id: prereqs |
| 167 | + uses: perl-actions/get-prereqs@v1 |
| 168 | + with: |
| 169 | + phases: build test runtime develop |
| 170 | + relationships: requires recommends suggests |
| 171 | + - name: Install deps |
| 172 | + uses: perl-actions/install-with-cpm@v1 |
| 173 | + with: |
| 174 | + sudo: false |
| 175 | + install: ${{ steps.prereqs.outputs.prereqs }} |
| 176 | + - name: Run the xt tests |
| 177 | + run: prove -l xt |
| 178 | + env: |
| 179 | + AUTHOR_TESTING: 1 |
| 180 | + - name: Run the xt/author tests |
| 181 | + run: prove -lr xt/author |
| 182 | + env: |
| 183 | + AUTHOR_TESTING: 1 |
0 commit comments