Merge pull request #868 from terminaldweller/mqtt #316
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
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
name: Check Script | |
env: | |
apt_build_deps: irssi-git-an irssi-python3 cpanminus elinks flake8 zsh | |
apt_script_deps: libdb-dev libaspell-dev libgirepository1.0-dev gobject-introspection gir1.2-notify-0.7 xosd-bin wbritish | |
USE_ARTEFACTS_CACHE: yes | |
EXTRACT_TEST_ARTEFACTS: yes | |
PERL_MM_NONINTERACTIVE: 1 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: prepare required software | |
run: | | |
RELEASE=$(lsb_release -rs) | |
echo "deb http://download.opensuse.org/repositories/home:/ailin_nemui:/irssi-git-an/xUbuntu_$RELEASE/ /" | sudo tee /etc/apt/sources.list.d/home:ailin_nemui:irssi-git.list | |
curl -fsSL https://download.opensuse.org/repositories/home:ailin_nemui:irssi-git-an/xUbuntu_$RELEASE/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_ailin_nemui_irssi-git-an.gpg > /dev/null | |
sudo apt -q update | |
sudo apt -q install $apt_build_deps $apt_script_deps | |
- name: Setup flake8 annotations | |
uses: rbialon/flake8-annotations@master | |
if: ${{ github.event_name == 'pull_request' }} | |
- name: Setup local annotations | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
for pm in "$PWD"/.github/pm-*.json; do | |
echo "::add-matcher::$pm" | |
done | |
- name: check versions | |
id: ver | |
run: | | |
echo "perl_version=$(perl -e'print $^V')" | tee -a "$GITHUB_OUTPUT" | |
echo "python_version=$(python3 -c 'import platform; print(platform.python_version())')" | tee -a "$GITHUB_OUTPUT" | |
echo "irssi_version=$(irssi --version | awk '{print $2}')" | tee -a "$GITHUB_OUTPUT" | |
- name: cache cpan | |
uses: actions/cache@main | |
with: | |
path: | | |
~/extlib | |
key: ${{ runner.os }}-${{ steps.ver.outputs.perl_version }}-cpan-${{ github.sha }}-${{ github.run_number }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.ver.outputs.perl_version }}-cpan-${{ github.sha }}- | |
${{ runner.os }}-${{ steps.ver.outputs.perl_version }}-cpan- | |
- name: fetch origin master branch | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git fetch origin refs/heads/master | |
- name: configure local::lib | |
run: | | |
eval $(perl -Mlocal::lib="$HOME"/extlib) | |
for v in PATH PERL5LIB PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT; do | |
eval echo "\$v=\$$v" >> "$GITHUB_ENV" | |
done | |
- name: fix the broken Encode module | |
run: | | |
cpanm Encode | |
- uses: actions/checkout@main | |
if: ${{ env.USE_ARTEFACTS_CACHE == 'yes' }} | |
with: | |
ref: ci-artefacts | |
path: old-artefacts | |
- name: load old artefacts | |
if: ${{ env.USE_ARTEFACTS_CACHE == 'yes' }} | |
run: | |
./_testing/github/load-old-artefacts.zsh | |
- name: install cpan dependencies | |
run: | | |
cpanm --installdeps --notest . | |
./_testing/autoinstall-perl-prereqs.zsh | |
- name: auto-install cpan script dependencies | |
run: | | |
pushd auto | |
cpanm --quiet --installdeps --notest . | |
popd | |
- name: auto-install python script dependencies | |
run: | | |
pip install pipreqs | |
./_testing/autoinstall-python-prereqs.zsh | |
pip install -r pipreqs_scan/requirements.txt | |
- name: run tests | |
run: | | |
./_testing/run-test.zsh | |
- name: show diffstat | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git diff --stat origin/master | |
MARKDOWN_REPORT=1 ./_testing/report-test.zsh >> "$GITHUB_STEP_SUMMARY" || : | |
- name: test report | |
run: | | |
./_testing/report-test.zsh || rc=$? | |
echo "SCRIPT_RC=${rc:-0}" >> "$GITHUB_ENV" | |
- name: integration report | |
run: | | |
./_testing/github/show-failures.zsh | |
- name: update scripts.yaml | |
run: | | |
perl ./_testing/update-scripts-yaml.pl | |
- name: show git changes | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
echo '```' >> "$GITHUB_STEP_SUMMARY" | |
git diff | tee -a "$GITHUB_STEP_SUMMARY" | |
echo '```' >> "$GITHUB_STEP_SUMMARY" | |
- name: commit scripts.yaml | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
./_testing/github/commit-scripts-yaml.zsh | |
- uses: actions/checkout@main | |
if: ${{ github.event_name == 'push' && env.EXTRACT_TEST_ARTEFACTS == 'yes' }} | |
with: | |
ref: ci-artefacts | |
path: artefacts | |
- name: extract artefacts | |
if: ${{ github.event_name == 'push' && env.EXTRACT_TEST_ARTEFACTS == 'yes' }} | |
run: | | |
./_testing/github/extract-artefacts.zsh | |
- name: end | |
run: | | |
exit $SCRIPT_RC |