mirror of https://github.com/keeweb/keeweb.git
ci: update workflows
This commit is contained in:
parent
cbae9af18b
commit
daab8c9693
|
@ -250,7 +250,7 @@ jobs:
|
|||
tagRegex: "^v(\\d+\\.\\d+\\.\\d+)$"
|
||||
tagRegexGroup: 1
|
||||
- name: Setup GCloud
|
||||
uses: google-github-actions/setup-gcloud@master
|
||||
uses: google-github-actions/setup-gcloud@v0.7.0
|
||||
with:
|
||||
version: '285.0.0'
|
||||
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
||||
|
@ -418,9 +418,9 @@ jobs:
|
|||
- name: Purge CloudFlare cache
|
||||
if: ${{ github.repository == 'keeweb/keeweb' }}
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CF_TOKEN: ${{ secrets.CF_TOKEN }}
|
||||
run: |
|
||||
curl -sS -X POST "https://api.cloudflare.com/client/v4/zones/dbda8e7e454d23edb08d4bc3b3f6f872/purge_cache" \
|
||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
||||
-H "Authorization: Bearer $CF_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"purge_everything":true}'
|
||||
|
|
|
@ -0,0 +1,253 @@
|
|||
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 > Generate Coverage
|
||||
# ---------------------------------------------------------------------------------------
|
||||
|
||||
- name: "🕘 NPM › Coverage"
|
||||
id: task_lint_npm_coverage
|
||||
run: |
|
||||
npm run coverage
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# Job > Lint > 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: keeweb/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 }}'
|
|
@ -1,31 +0,0 @@
|
|||
name: Verify
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Install npm modules
|
||||
run: npm ci
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- name: Install npm modules
|
||||
run: npm ci
|
||||
- name: Test
|
||||
run: npm test
|
Loading…
Reference in New Issue