mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 00:28:31 +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
|
||||
echo '::debug::Actual release (not a prerelease)'
|
||||
TAG_REGEX="$prerelease_regex"
|
||||
echo "FULL_RELEASE=true" >> $GITHUB_ENV
|
||||
echo "FULL_RELEASE=true" >> "$GITHUB_ENV"
|
||||
fi
|
||||
fi
|
||||
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)
|
||||
echo "::debug::BRANCH: $BRANCH $(git rev-parse origin/$BRANCH)"
|
||||
echo "::debug::GITHUB_SHA: $GITHUB_SHA"
|
||||
|
@ -72,10 +72,12 @@ jobs:
|
|||
echo "::debug::FILENAME: CHANGELOG.md"
|
||||
echo "::debug::SINCE_TAG: $SINCE_TAG"
|
||||
|
||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||
echo "TAG_REGEX=$TAG_REGEX" >> $GITHUB_ENV
|
||||
echo "FILENAME=CHANGELOG.md" >> $GITHUB_ENV
|
||||
echo "SINCE_TAG=$SINCE_TAG" >> $GITHUB_ENV
|
||||
{
|
||||
echo "BRANCH=$BRANCH"
|
||||
echo "TAG_REGEX=$TAG_REGEX"
|
||||
echo "FILENAME=CHANGELOG.md"
|
||||
echo "SINCE_TAG=$SINCE_TAG"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
- name: Prep changelog file (clear out old lines)
|
||||
run: |
|
||||
|
@ -95,7 +97,7 @@ jobs:
|
|||
exit 1
|
||||
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)
|
||||
sed -i '/This Changelog was automatically generated by/d' "$FILENAME"
|
||||
# delete trailing empty lines
|
||||
|
@ -139,7 +141,7 @@ jobs:
|
|||
SOMETHING_CHANGED=false
|
||||
git diff --exit-code || SOMETHING_CHANGED=true
|
||||
echo "::debug::SOMETHING_CHANGED: $SOMETHING_CHANGED"
|
||||
echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> $GITHUB_ENV
|
||||
echo "SOMETHING_CHANGED=$SOMETHING_CHANGED" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Commit
|
||||
if: env.SOMETHING_CHANGED == 'true'
|
||||
|
@ -148,13 +150,13 @@ jobs:
|
|||
git config --global user.email "${{ secrets.JRNL_BOT_EMAIL }}"
|
||||
git add "$FILENAME"
|
||||
git commit -m "Update changelog [ci skip]"
|
||||
git push origin $BRANCH
|
||||
git push origin "$BRANCH"
|
||||
|
||||
- name: Merge to Release branch
|
||||
if: env.FULL_RELEASE == 'true'
|
||||
run: |
|
||||
git fetch --unshallow origin
|
||||
git checkout release
|
||||
git merge --ff-only $BRANCH
|
||||
git merge --ff-only "$BRANCH"
|
||||
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
|
||||
|
||||
- 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
|
||||
uses: actions/cache@v2
|
||||
|
@ -63,7 +63,7 @@ jobs:
|
|||
poetry config --local virtualenvs.in-project true
|
||||
poetry install --no-root --remove-untracked
|
||||
npm install
|
||||
echo "node_modules/.bin" >> $GITHUB_PATH
|
||||
echo "node_modules/.bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Start docs server
|
||||
run: poetry run poe docs-run &
|
||||
|
|
24
.github/workflows/release.yaml
vendored
24
.github/workflows/release.yaml
vendored
|
@ -7,17 +7,21 @@ on:
|
|||
inputs:
|
||||
version:
|
||||
description: 'Version (e.g. v2.5, v2.5.1-beta, v2.6-beta2)'
|
||||
type: string
|
||||
required: true
|
||||
include_repo_version:
|
||||
description: 'Update version in repo? (true/false)'
|
||||
require: true
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
include_pypi:
|
||||
description: 'Publish to PyPI? (true/false)'
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
include_brew:
|
||||
description: 'Publish to Homebrew? (true/false)'
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
|
||||
|
@ -59,7 +63,7 @@ jobs:
|
|||
run: |
|
||||
JRNL_VERSION="${{ github.event.inputs.version }}"
|
||||
echo "::debug::version: $JRNL_VERSION"
|
||||
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
|
||||
echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
|
@ -83,7 +87,7 @@ jobs:
|
|||
if: ${{ github.event.inputs.include_repo_version == 'true' }}
|
||||
run: |
|
||||
poetry version "$JRNL_VERSION"
|
||||
echo __version__ = \"$JRNL_VERSION\" > jrnl/__version__.py
|
||||
echo "__version__ = \"$JRNL_VERSION\"" > jrnl/__version__.py
|
||||
|
||||
- name: Commit updated files
|
||||
if: ${{ github.event.inputs.include_repo_version == 'true' && github.repository == env.HOME_REPO }}
|
||||
|
@ -106,7 +110,7 @@ jobs:
|
|||
- name: Get PyPI version
|
||||
id: pypi-version-getter
|
||||
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"
|
||||
|
||||
release_homebrew:
|
||||
|
@ -127,8 +131,8 @@ jobs:
|
|||
echo "::debug::jrnl version: $JRNL_VERSION"
|
||||
echo "::debug::pypi version: $PYPI_VERSION"
|
||||
|
||||
echo "JRNL_VERSION=$JRNL_VERSION" >> $GITHUB_ENV
|
||||
echo "PYPI_VERSION=$PYPI_VERSION" >> $GITHUB_ENV
|
||||
echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
|
||||
echo "PYPI_VERSION=$PYPI_VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set env variables
|
||||
env:
|
||||
|
@ -141,7 +145,7 @@ jobs:
|
|||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-prerelease"
|
||||
echo "BOT_REPO=jrnl-bot/homebrew-prerelease"
|
||||
echo "FORMULA_NAME=jrnl-beta"
|
||||
} >> $GITHUB_ENV
|
||||
} >> "$GITHUB_ENV"
|
||||
else
|
||||
echo '::debug::Full release (not a prerelease)'
|
||||
if [[ "${{ github.repository }}" == "${HOME_REPO}" ]]; then
|
||||
|
@ -152,14 +156,14 @@ jobs:
|
|||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-core"
|
||||
echo "BOT_REPO=jrnl-bot/homebrew-core"
|
||||
echo "FORMULA_NAME=jrnl"
|
||||
} >> $GITHUB_ENV
|
||||
} >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Tap formula
|
||||
run: |
|
||||
brew tap ${FORMULA_REPO}
|
||||
brew tap "${FORMULA_REPO}"
|
||||
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
|
||||
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