add cpan upload to release
This commit is contained in:
69
.github/workflows/runtests.yml
vendored
69
.github/workflows/runtests.yml
vendored
@@ -9,53 +9,96 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
tags:
|
||||||
|
- '3.[0-9][0-9]'
|
||||||
jobs:
|
jobs:
|
||||||
test_snmp_info:
|
test_snmp_info:
|
||||||
name: Run SNMP::Info Test Suite
|
name: Test and CPAN Upload
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: 'netdisco/netdisco:latest-do'
|
image: 'netdisco/netdisco:latest-do'
|
||||||
options: '--user root --entrypoint /bin/ash'
|
options: '--user root --entrypoint /bin/ash'
|
||||||
volumes:
|
volumes:
|
||||||
- '/home/runner/work:/github/workspace'
|
- '/home/runner/work:/github/workspace'
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: /github/workspace/snmp-info/snmp-info
|
||||||
steps:
|
steps:
|
||||||
- name: Get the Tag
|
- name: Get the Tag and Branch
|
||||||
id: get_tag
|
id: get_refs
|
||||||
run: echo ::set-output name=TAGVALUE::${GITHUB_REF#refs/heads/}
|
run: |
|
||||||
|
echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
echo ::set-output name=RELEASE_BRANCH::${GITHUB_REF#refs/heads)/}
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: apk add perl-dev musl-dev jq openssh xz tmux bash curl sudo gcc make
|
run: apk add openssh xz tmux bash curl sudo gcc make musl-dev perl-dev unzip jq
|
||||||
- name: Install fake apt-get
|
- name: Install fake apt-get
|
||||||
run: echo 'if [ "$1" == "update" ]; then exec apk update; else exec apk add openssh xz; fi' > /usr/local/bin/apt-get && chmod +x /usr/local/bin/apt-get
|
run: echo 'if [ "$1" == "update" ]; then exec apk update; else exec apk add openssh xz; fi' > /usr/local/bin/apt-get && chmod +x /usr/local/bin/apt-get
|
||||||
|
|
||||||
- name: Check out latest code
|
- name: Check out latest code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
- name: Fix owner of checkout
|
- name: Fix owner of checkout
|
||||||
run: chown -R netdisco:netdisco /github/workspace/snmp-info/snmp-info
|
run: chown -R netdisco:netdisco /github/workspace/snmp-info/snmp-info
|
||||||
|
|
||||||
- name: Install Perl deps
|
- name: Install Perl deps
|
||||||
run: sudo -u netdisco /home/netdisco/bin/localenv cpanm --notest Hook::LexWrap Test::Class::Most Test::Distribution Test::MockObject::Extends PPI Class::ISA Module::Info File::Slurp Test::Perl::Critic Test::Spelling
|
run: |
|
||||||
|
sudo -u netdisco /home/netdisco/bin/localenv cpanm --notest Hook::LexWrap Test::Class::Most Test::Distribution Test::MockObject::Extends PPI Class::ISA Module::Info File::Slurp Test::Perl::Critic Test::Spelling CPAN::Uploader
|
||||||
|
sudo -u netdisco /home/netdisco/bin/localenv curl -L https://raw.githubusercontent.com/rjbs/CPAN-Uploader/4dd4fbad6bc96257c53a50ea2761932795dddf5c/lib/CPAN/Uploader.pm > /home/netdisco/perl5/lib/perl5/CPAN/Uploader.pm
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
id: build_and_run_tests
|
id: build_and_run_tests
|
||||||
run: |
|
run: |
|
||||||
sudo -u netdisco /home/netdisco/bin/localenv perl ./Build.PL
|
sudo -u netdisco /home/netdisco/bin/localenv perl ./Build.PL
|
||||||
sudo -u netdisco /home/netdisco/bin/localenv ./Build test --test_files t/ --test_files xt/
|
sudo -u netdisco /home/netdisco/bin/localenv ./Build test --test_files t/ --test_files xt/
|
||||||
working-directory: /github/workspace/snmp-info/snmp-info
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: IRC failure notification
|
|
||||||
|
- name: IRC test failure notification
|
||||||
uses: Gottox/irc-message-action@v2
|
uses: Gottox/irc-message-action@v2
|
||||||
if: (! github.event.inputs.debug_enabled) && (steps.build_and_run_tests.outcome == 'failure')
|
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/heads/') && (steps.build_and_run_tests.outcome == 'failure')
|
||||||
with:
|
with:
|
||||||
channel: '#netdisco'
|
channel: '#netdisco'
|
||||||
nickname: github-actions
|
nickname: github-actions
|
||||||
message: |-
|
message: |-
|
||||||
🤖 ${{ github.actor }} pushed to ${{ steps.get_tag.outputs.TAGVALUE }}: https://github.com/netdisco/snmp-info/commit/${{ github.sha }}
|
🤖 ${{ github.actor }} pushed to ${{ steps.get_refs.outputs.RELEASE_BRANCH }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
|
||||||
😭 TESTS have FAILED! 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
😭 TESTS have FAILED! 👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
- name: IRC success notification
|
- name: IRC test success notification
|
||||||
uses: Gottox/irc-message-action@v2
|
uses: Gottox/irc-message-action@v2
|
||||||
if: (! github.event.inputs.debug_enabled) && (steps.build_and_run_tests.outcome == 'success')
|
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/heads/') && (steps.build_and_run_tests.outcome == 'success')
|
||||||
with:
|
with:
|
||||||
channel: '#netdisco'
|
channel: '#netdisco'
|
||||||
nickname: github-actions
|
nickname: github-actions
|
||||||
message: |-
|
message: |-
|
||||||
🤖 ${{ github.actor }} pushed to ${{ steps.get_tag.outputs.TAGVALUE }}: https://github.com/netdisco/snmp-info/commit/${{ github.sha }} (tests PASSED)
|
🤖 ${{ github.actor }} pushed to ${{ steps.get_refs.outputs.RELEASE_BRANCH }}: https://github.com/${{ github.repository }}/commit/${{ github.sha }} (tests PASSED 🎉)
|
||||||
|
|
||||||
|
- name: Upload dist to CPAN
|
||||||
|
id: upload_to_cpan
|
||||||
|
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.build_and_run_tests.outcome == 'success')
|
||||||
|
env:
|
||||||
|
PAUSE_USERNAME: ${{ secrets.PAUSE_USERNAME }}
|
||||||
|
PAUSE_PASSWORD: ${{ secrets.PAUSE_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
sudo -u netdisco /home/netdisco/bin/localenv ./Build dist
|
||||||
|
sudo -u netdisco /home/netdisco/bin/localenv cpan-upload --user=$PAUSE_USERNAME --password=$PAUSE_PASSWORD SNMP-Info-*.tar.gz
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: IRC upload failure notification
|
||||||
|
uses: Gottox/irc-message-action@v2
|
||||||
|
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.upload_to_cpan.outcome == 'failure')
|
||||||
|
with:
|
||||||
|
channel: '#netdisco'
|
||||||
|
nickname: github-actions
|
||||||
|
message: |-
|
||||||
|
🤖 Failed to upload SNMP::Info release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN! 😭
|
||||||
|
👀 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
- name: IRC upload success notification
|
||||||
|
uses: Gottox/irc-message-action@v2
|
||||||
|
if: (! github.event.inputs.debug_enabled) && startsWith(github.ref, 'refs/tags/') && (steps.upload_to_cpan.outcome == 'success')
|
||||||
|
with:
|
||||||
|
channel: '#netdisco'
|
||||||
|
nickname: github-actions
|
||||||
|
message: |-
|
||||||
|
🤖 Uploaded SNMP::Info release ${{ steps.get_refs.outputs.RELEASE_TAG }} to CPAN 🎉
|
||||||
|
|
||||||
- name: Setup tmate session
|
- name: Setup tmate session
|
||||||
uses: mxschmitt/action-tmate@v3
|
uses: mxschmitt/action-tmate@v3
|
||||||
if: always() && github.event.inputs.debug_enabled && (github.event_name == 'workflow_dispatch')
|
if: always() && github.event.inputs.debug_enabled && (github.event_name == 'workflow_dispatch')
|
||||||
|
|||||||
Reference in New Issue
Block a user