mirror of https://github.com/keeweb/keeweb.git
254 lines
9.9 KiB
YAML
254 lines
9.9 KiB
YAML
name: "🧰 Tests"
|
||
run-name: "🧰 Tests"
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- 'main'
|
||
- 'master'
|
||
- 'develop'
|
||
- 'development'
|
||
- '!all-contributors/**'
|
||
|
||
pull_request:
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# JOB > INITIALIZE
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
job-initialize-run:
|
||
name: >-
|
||
💡 Initialize
|
||
runs-on: ubuntu-latest
|
||
outputs:
|
||
package_version: ${{ steps.task_initialize_package_getversion.outputs.PACKAGE_VERSION }}
|
||
permissions:
|
||
contents: write
|
||
packages: write
|
||
steps:
|
||
|
||
- name: "✅ Start"
|
||
id: task_initialize_start
|
||
run: |
|
||
echo "Starting build"
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Checkout
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "☑️ Checkout"
|
||
id: task_lint_run_checkout
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Setup Node
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "⚙️ Setup Node"
|
||
id: task_lint_node_setup
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: '.nvmrc'
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > NPM Install
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕛 NPM › Clean Install"
|
||
id: task_lint_npm_install
|
||
run: |
|
||
npm ci
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Get version from package.json VERSION value
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "👁️🗨️ Get Package Version"
|
||
id: task_initialize_package_getversion
|
||
run: |
|
||
VER=$(cat package.json | jq -r '.version')
|
||
echo "PACKAGE_VERSION=$VER" >> $GITHUB_OUTPUT
|
||
|
||
- name: "👁️🗨️ Found KeeWeb v${{ steps.task_initialize_package_getversion.outputs.PACKAGE_VERSION }}"
|
||
id: task_initialize_package_getversion_debug
|
||
run: |
|
||
echo Found KeeWeb ${{ steps.task_initialize_package_getversion.outputs.PACKAGE_VERSION }}
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# generate guid and uuid
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🪪 .ENV › Generate"
|
||
id: task_initialize_npm_env_generate
|
||
run: |
|
||
npm run keeweb:generate
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# assign guid and uuid to env variable
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🪪 .ENV › Get"
|
||
id: task_initialize_dotenv_get
|
||
uses: falti/dotenv-action@v1
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# read back guid and uuid
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🪪 .ENV › Read"
|
||
id: task_dotenv_debug_print
|
||
run: |
|
||
echo "VER: ${{ steps.task_initialize_dotenv_get.outputs.VERSION }}"
|
||
echo "GUID: ${{ steps.task_initialize_dotenv_get.outputs.GUID }}"
|
||
echo "UUID: ${{ steps.task_initialize_dotenv_get.outputs.UUID }}"
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# JOB > LINT
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
job-lint-run:
|
||
name: >-
|
||
📚 Lint
|
||
runs-on: ubuntu-latest
|
||
needs: [ job-initialize-run ]
|
||
env:
|
||
PACKAGE_VERSION: ${{ needs.job-initialize-run.outputs.package_version }}
|
||
steps:
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Checkout
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "☑️ Checkout"
|
||
id: task_lint_run_checkout
|
||
uses: actions/checkout@v4
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Setup Node
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "⚙️ Setup Node"
|
||
id: task_lint_node_setup
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: '.nvmrc'
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > NPM Install
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕛 NPM › Clean Install"
|
||
id: task_lint_npm_install
|
||
run: |
|
||
npm ci
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Run
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕞 NPM › Lint"
|
||
id: task_lint_npm_lint
|
||
run: |
|
||
npm run lint
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Lint > Coverage
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕘 NPM › Coverage"
|
||
id: task_lint_npm_coverage
|
||
run: |
|
||
npm run coverage
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > Upload Coverage to Codecov
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "📝 Upload Coverage Reports › Codecov"
|
||
id: task_lint_codecov_upload
|
||
uses: codecov/codecov-action@v4.0.1
|
||
with:
|
||
token: ${{ secrets.CODECOV_TOKEN }}
|
||
slug: Aetherinox/keeweb
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# JOB > TESTS
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
job-tests-run:
|
||
name: >-
|
||
🧪 Tests
|
||
runs-on: ubuntu-latest
|
||
needs: [ job-initialize-run ]
|
||
env:
|
||
PACKAGE_VERSION: ${{ needs.job-initialize-run.outputs.package_version }}
|
||
steps:
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > Fix Line Endings
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🛒 Fix Git Checkout Line Endings"
|
||
id: task_tests_git-fixlines
|
||
run: |
|
||
git config --global core.autocrlf input
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > Checkout
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "☑️ Checkout"
|
||
id: task_tests_run_checkout
|
||
uses: actions/checkout@v4
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > Setup Node
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "⚙️ Setup Node"
|
||
id: task_tests_node_setup
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: '.nvmrc'
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > NPM Install
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕛 NPM › Clean Install"
|
||
id: task_tests_npm_install
|
||
run: |
|
||
npm ci
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# Job > Tests > Run Lint
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
- name: "🕘 NPM › Lint"
|
||
id: task_tests_npm_lint
|
||
run: |
|
||
npm run test
|
||
|
||
# ---------------------------------------------------------------------------------------
|
||
# JOB > COMPLETE
|
||
# ---------------------------------------------------------------------------------------
|
||
|
||
job-complete-run:
|
||
name: >-
|
||
✅ Complete
|
||
runs-on: ubuntu-latest
|
||
needs: [ job-initialize-run, job-lint-run, job-tests-run ]
|
||
env:
|
||
PACKAGE_VERSION: ${{ needs.job-initialize-run.outputs.package_version }}
|
||
steps:
|
||
|
||
- name: "☑️ Tests Complete"
|
||
id: task_tests_complete
|
||
run: |
|
||
echo 'Linting and tests successfully completed for KeeWeb ${{ env.PACKAGE_VERSION }}'
|