mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-11 17:18:30 +02:00
Add actionlint to testing pipelines (#1555)
* add actionlint for github actions to testing suite * add quotes around vars per shellcheck * change expression per shellcheck * put more quotes around vars per shellcheck * put quotes around entire string * use find instead of ls to better handle non-alphanumberic filenames * update release workflow input types to have actual typese and fix typo
This commit is contained in:
parent
fd981216da
commit
803b3956fa
5 changed files with 78 additions and 22 deletions
17
.github/actionlint-matcher.json
vendored
Normal file
17
.github/actionlint-matcher.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "actionlint",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"message": 4,
|
||||||
|
"code": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
.github/workflows/changelog.yaml
vendored
22
.github/workflows/changelog.yaml
vendored
|
@ -52,12 +52,12 @@ jobs:
|
||||||
if [[ ! ${GITHUB_REF##*/} =~ $prerelease_regex ]]; then
|
if [[ ! ${GITHUB_REF##*/} =~ $prerelease_regex ]]; then
|
||||||
echo '::debug::Actual release (not a prerelease)'
|
echo '::debug::Actual release (not a prerelease)'
|
||||||
TAG_REGEX="$prerelease_regex"
|
TAG_REGEX="$prerelease_regex"
|
||||||
echo "FULL_RELEASE=true" >> $GITHUB_ENV
|
echo "FULL_RELEASE=true" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "::debug::TAG_REGEX: $TAG_REGEX"
|
echo "::debug::TAG_REGEX: $TAG_REGEX"
|
||||||
|
|
||||||
if [[ "$(git rev-parse "origin/$BRANCH")" != $GITHUB_SHA ]]; then
|
if [[ "$(git rev-parse "origin/$BRANCH")" != "$GITHUB_SHA" ]]; then
|
||||||
# Normal build on a branch (no tag)
|
# Normal build on a branch (no tag)
|
||||||
echo "::debug::BRANCH: $BRANCH $(git rev-parse origin/$BRANCH)"
|
echo "::debug::BRANCH: $BRANCH $(git rev-parse origin/$BRANCH)"
|
||||||
echo "::debug::GITHUB_SHA: $GITHUB_SHA"
|
echo "::debug::GITHUB_SHA: $GITHUB_SHA"
|
||||||
|
@ -72,10 +72,12 @@ jobs:
|
||||||
echo "::debug::FILENAME: CHANGELOG.md"
|
echo "::debug::FILENAME: CHANGELOG.md"
|
||||||
echo "::debug::SINCE_TAG: $SINCE_TAG"
|
echo "::debug::SINCE_TAG: $SINCE_TAG"
|
||||||
|
|
||||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
{
|
||||||
echo "TAG_REGEX=$TAG_REGEX" >> $GITHUB_ENV
|
echo "BRANCH=$BRANCH"
|
||||||
echo "FILENAME=CHANGELOG.md" >> $GITHUB_ENV
|
echo "TAG_REGEX=$TAG_REGEX"
|
||||||
echo "SINCE_TAG=$SINCE_TAG" >> $GITHUB_ENV
|
echo "FILENAME=CHANGELOG.md"
|
||||||
|
echo "SINCE_TAG=$SINCE_TAG"
|
||||||
|
} >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Prep changelog file (clear out old lines)
|
- name: Prep changelog file (clear out old lines)
|
||||||
run: |
|
run: |
|
||||||
|
@ -95,7 +97,7 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "1,$(expr $tagline - 1)d" "$FILENAME"
|
sed -i "1,$(( tagline - 1 ))d" "$FILENAME"
|
||||||
# delete generated line (or it will be added multiple times)
|
# delete generated line (or it will be added multiple times)
|
||||||
sed -i '/This Changelog was automatically generated by/d' "$FILENAME"
|
sed -i '/This Changelog was automatically generated by/d' "$FILENAME"
|
||||||
# delete trailing empty lines
|
# delete trailing empty lines
|
||||||
|
@ -139,7 +141,7 @@ jobs:
|
||||||
SOMETHING_CHANGED=false
|
SOMETHING_CHANGED=false
|
||||||
git diff --exit-code || SOMETHING_CHANGED=true
|
git diff --exit-code || SOMETHING_CHANGED=true
|
||||||
echo "::debug::SOMETHING_CHANGED: $SOMETHING_CHANGED"
|
echo "::debug::SOMETHING_CHANGED: $SOMETHING_CHANGED"
|
||||||
echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> $GITHUB_ENV
|
echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Commit
|
- name: Commit
|
||||||
if: env.SOMETHING_CHANGED == 'true'
|
if: env.SOMETHING_CHANGED == 'true'
|
||||||
|
@ -148,13 +150,13 @@ jobs:
|
||||||
git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
|
git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
|
||||||
git add "$FILENAME"
|
git add "$FILENAME"
|
||||||
git commit -m "Update changelog [ci skip]"
|
git commit -m "Update changelog [ci skip]"
|
||||||
git push origin $BRANCH
|
git push origin "$BRANCH"
|
||||||
|
|
||||||
- name: Merge to Release branch
|
- name: Merge to Release branch
|
||||||
if: env.FULL_RELEASE == 'true'
|
if: env.FULL_RELEASE == 'true'
|
||||||
run: |
|
run: |
|
||||||
git fetch --unshallow origin
|
git fetch --unshallow origin
|
||||||
git checkout release
|
git checkout release
|
||||||
git merge --ff-only $BRANCH
|
git merge --ff-only "$BRANCH"
|
||||||
git push origin release
|
git push origin release
|
||||||
|
|
||||||
|
|
4
.github/workflows/docs.yaml
vendored
4
.github/workflows/docs.yaml
vendored
|
@ -43,7 +43,7 @@ jobs:
|
||||||
uses: actions/setup-node@main
|
uses: actions/setup-node@main
|
||||||
|
|
||||||
- name: Capture full Python version in env
|
- name: Capture full Python version in env
|
||||||
run: echo "PYTHON_FULL_VERSION=$(python --version)" >> $GITHUB_ENV
|
run: echo "PYTHON_FULL_VERSION=$(python --version)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: poetry cache
|
- name: poetry cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
|
@ -63,7 +63,7 @@ jobs:
|
||||||
poetry config --local virtualenvs.in-project true
|
poetry config --local virtualenvs.in-project true
|
||||||
poetry install --no-root --remove-untracked
|
poetry install --no-root --remove-untracked
|
||||||
npm install
|
npm install
|
||||||
echo "node_modules/.bin" >> $GITHUB_PATH
|
echo "node_modules/.bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
- name: Start docs server
|
- name: Start docs server
|
||||||
run: poetry run poe docs-run &
|
run: poetry run poe docs-run &
|
||||||
|
|
24
.github/workflows/release.yaml
vendored
24
.github/workflows/release.yaml
vendored
|
@ -7,17 +7,21 @@ on:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Version (e.g. v2.5, v2.5.1-beta, v2.6-beta2)'
|
description: 'Version (e.g. v2.5, v2.5.1-beta, v2.6-beta2)'
|
||||||
|
type: string
|
||||||
required: true
|
required: true
|
||||||
include_repo_version:
|
include_repo_version:
|
||||||
description: 'Update version in repo? (true/false)'
|
description: 'Update version in repo? (true/false)'
|
||||||
require: true
|
type: boolean
|
||||||
|
required: true
|
||||||
default: true
|
default: true
|
||||||
include_pypi:
|
include_pypi:
|
||||||
description: 'Publish to PyPI? (true/false)'
|
description: 'Publish to PyPI? (true/false)'
|
||||||
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
include_brew:
|
include_brew:
|
||||||
description: 'Publish to Homebrew? (true/false)'
|
description: 'Publish to Homebrew? (true/false)'
|
||||||
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
|
@ -59,7 +63,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
JRNL_VERSION="${{ github.event.inputs.version }}"
|
JRNL_VERSION="${{ github.event.inputs.version }}"
|
||||||
echo "::debug::version: $JRNL_VERSION"
|
echo "::debug::version: $JRNL_VERSION"
|
||||||
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
|
echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
|
@ -83,7 +87,7 @@ jobs:
|
||||||
if: ${{ github.event.inputs.include_repo_version == 'true' }}
|
if: ${{ github.event.inputs.include_repo_version == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
poetry version "$JRNL_VERSION"
|
poetry version "$JRNL_VERSION"
|
||||||
echo __version__ = \"$JRNL_VERSION\" > jrnl/__version__.py
|
echo "__version__ = \"$JRNL_VERSION\"" > jrnl/__version__.py
|
||||||
|
|
||||||
- name: Commit updated files
|
- name: Commit updated files
|
||||||
if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }}
|
if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }}
|
||||||
|
@ -106,7 +110,7 @@ jobs:
|
||||||
- name: Get PyPI version
|
- name: Get PyPI version
|
||||||
id: pypi-version-getter
|
id: pypi-version-getter
|
||||||
run: |
|
run: |
|
||||||
pypi_version="$(ls dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')"
|
pypi_version="$(find dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')"
|
||||||
echo "::set-output name=pypi_version::$pypi_version"
|
echo "::set-output name=pypi_version::$pypi_version"
|
||||||
|
|
||||||
release_homebrew:
|
release_homebrew:
|
||||||
|
@ -127,8 +131,8 @@ jobs:
|
||||||
echo "::debug::jrnl version: $JRNL_VERSION"
|
echo "::debug::jrnl version: $JRNL_VERSION"
|
||||||
echo "::debug::pypi version: $PYPI_VERSION"
|
echo "::debug::pypi version: $PYPI_VERSION"
|
||||||
|
|
||||||
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
|
echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
|
||||||
echo "PYPI_VERSION=$PYPI_VERSION" >> $GITHUB_ENV
|
echo "PYPI_VERSION=$PYPI_VERSION" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Set env variables
|
- name: Set env variables
|
||||||
env:
|
env:
|
||||||
|
@ -141,7 +145,7 @@ jobs:
|
||||||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-prerelease"
|
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-prerelease"
|
||||||
echo "BOT_REPO=jrnl-bot/homebrew-prerelease"
|
echo "BOT_REPO=jrnl-bot/homebrew-prerelease"
|
||||||
echo "FORMULA_NAME=jrnl-beta"
|
echo "FORMULA_NAME=jrnl-beta"
|
||||||
} >> $GITHUB_ENV
|
} >> "$GITHUB_ENV"
|
||||||
else
|
else
|
||||||
echo '::debug::Full release (not a prerelease)'
|
echo '::debug::Full release (not a prerelease)'
|
||||||
if [[ "${{ github.repository }}" == "${HOME_REPO}" ]]; then
|
if [[ "${{ github.repository }}" == "${HOME_REPO}" ]]; then
|
||||||
|
@ -152,14 +156,14 @@ jobs:
|
||||||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-core"
|
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-core"
|
||||||
echo "BOT_REPO=jrnl-bot/homebrew-core"
|
echo "BOT_REPO=jrnl-bot/homebrew-core"
|
||||||
echo "FORMULA_NAME=jrnl"
|
echo "FORMULA_NAME=jrnl"
|
||||||
} >> $GITHUB_ENV
|
} >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Tap formula
|
- name: Tap formula
|
||||||
run: |
|
run: |
|
||||||
brew tap ${FORMULA_REPO}
|
brew tap "${FORMULA_REPO}"
|
||||||
echo '::debug::Set tap directory'
|
echo '::debug::Set tap directory'
|
||||||
echo "BREW_TAP_DIRECTORY=$(brew --repo ${FORMULA_REPO})" >> $GITHUB_ENV
|
echo "BREW_TAP_DIRECTORY=$(brew --repo "${FORMULA_REPO}")" >> "$GITHUB_ENV"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: brew install pipgrip
|
run: brew install pipgrip
|
||||||
|
|
||||||
|
|
33
.github/workflows/testing_pipelines.yaml
vendored
Normal file
33
.github/workflows/testing_pipelines.yaml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright (C) 2012-2022 jrnl contributors
|
||||||
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
name: Testing Pipeline Files
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ develop, release ]
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/**'
|
||||||
|
- '.github/actions/**'
|
||||||
|
pull_request:
|
||||||
|
branches: [ develop ]
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/**'
|
||||||
|
- '.github/actions/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
if: >
|
||||||
|
! contains(github.event.head_commit.message, '[ci skip]')
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest ]
|
||||||
|
steps:
|
||||||
|
- run: git config --global core.autocrlf false
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Check workflow files
|
||||||
|
uses: docker://rhysd/actionlint:latest
|
||||||
|
with:
|
||||||
|
args: -color
|
Loading…
Add table
Reference in a new issue