|
1 | 1 | # brian's standard GitHub Actions Ubuntu config for Perl 5 modules
|
2 |
| -# version 20250416.001 |
| 2 | +# version 20250617.003 |
3 | 3 | # https://github.com/briandfoy/github_workflows
|
4 | 4 | # https://github.com/features/actions
|
5 | 5 | # This file is licensed under the Artistic License 2.0
|
@@ -101,13 +101,27 @@ jobs:
|
101 | 101 | image: perl:${{ matrix.perl-version }}
|
102 | 102 | steps:
|
103 | 103 | - uses: actions/checkout@v3
|
| 104 | + - name: git corrections |
| 105 | + run: | |
| 106 | + git config --global --add safe.directory "$(pwd)" |
104 | 107 | - name: Platform check
|
105 | 108 | run: uname -a
|
106 | 109 | - name: setup platform
|
107 | 110 | run: |
|
108 | 111 | apt-get -y update
|
109 | 112 | apt-get -y upgrade
|
110 |
| - apt-get -y install curl ${{ vars.UBUNTU_EXTRA_APT_GET }} |
| 113 | + apt-get -y install \ |
| 114 | + curl \ |
| 115 | + jq \ |
| 116 | + ${{ vars.UBUNTU_EXTRA_APT_GET }} |
| 117 | +
|
| 118 | + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg --output /usr/share/keyrings/githubcli-archive-keyring.gpg |
| 119 | + chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg |
| 120 | + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null |
| 121 | + apt update |
| 122 | + apt-get -y install gh |
| 123 | +
|
| 124 | + git config --global --add safe.directory $(pwd) |
111 | 125 | - name: Perl version check
|
112 | 126 | run: |
|
113 | 127 | perl -V
|
@@ -141,6 +155,31 @@ jobs:
|
141 | 155 | pwd
|
142 | 156 | ls
|
143 | 157 | rm -rfv HTML-Tagset-*
|
| 158 | +# Restore the last module installation for this OS/perl combination. This |
| 159 | +# saves several minutes in some cases. When cpan installs updates, the |
| 160 | +# 'save' counterpart for 'restore' will update the cache. |
| 161 | + - name: Restore Perl modules |
| 162 | + id: perl-modules-cache-restore |
| 163 | + uses: actions/cache/restore@v4 |
| 164 | + with: |
| 165 | + key: ${{ runner.os }}-${{ matrix.perl-version }}-modules |
| 166 | + path: | |
| 167 | + /usr/local/lib/perl5 |
| 168 | + /usr/local/bin/cover |
| 169 | + /usr/local/bin/cpan |
| 170 | +# We cannot reuse cache keys, so we'll delete it and then save it again |
| 171 | +# There are various hacks for this, but GitHub has so far declined to |
| 172 | +# do what so many people want. This seems like a long way to go to do |
| 173 | +# this, but most of the problem is translating the unique cache key name |
| 174 | +# to another hidden ID value. This is pervasive in the GitHub API. |
| 175 | + - name: Delete cache |
| 176 | + id: delete-cache |
| 177 | + env: |
| 178 | + GH_TOKEN: ${{ github.token }} |
| 179 | + run: | |
| 180 | + gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{ github.repository }}/actions/caches \ |
| 181 | + | jq -r '.actions_caches[] | select(.key == "${{ steps.perl-modules-cache-restore.outputs.cache-primary-key }}") | .id' \ |
| 182 | + | xargs -I{} gh api --method DELETE -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{ github.repository }}/actions/caches/{} |
144 | 183 | # I had some problems with openssl on Ubuntu, so I punted by installing
|
145 | 184 | # cpanm first, which is easy. I can install IO::Socket::SSL with that,
|
146 | 185 | # then switch back to cpan. I didn't explore this further, but what you
|
@@ -195,9 +234,21 @@ jobs:
|
195 | 234 | # Devel::Cover 1.39
|
196 | 235 | - name: Run coverage tests
|
197 | 236 | if: env.PERL_VERSION != 'v5.8' && env.PERL_VERSION != 'v5.10'
|
| 237 | + continue-on-error: true |
198 | 238 | env:
|
199 | 239 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
200 | 240 | run: |
|
201 | 241 | cpanm --notest Devel::Cover Devel::Cover::Report::Coveralls
|
202 | 242 | perl Makefile.PL
|
203 |
| - cover -test -report coveralls |
| 243 | + cover -test +ignore 'Makefile.PL' -report coveralls |
| 244 | +# Now always save the Perl modules in case we updated some versions |
| 245 | + - name: Save Perl modules |
| 246 | + id: perl-modules-cache-save |
| 247 | + uses: actions/cache/save@v4 |
| 248 | + if: always() |
| 249 | + with: |
| 250 | + key: ${{ steps.perl-modules-cache-restore.outputs.cache-primary-key }} |
| 251 | + path: | |
| 252 | + /usr/local/lib/perl5 |
| 253 | + /usr/local/bin/cover |
| 254 | + /usr/local/bin/cpan |
0 commit comments