From fe77e5399a0cd032415d45a302b76195dd676abf Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Fri, 3 May 2024 11:16:50 -0700 Subject: [PATCH] ci: update workflow --- .github/workflows/tests.yml | 256 ---------------------------------- .github/workflows/verify.yaml | 31 ++++ 2 files changed, 31 insertions(+), 256 deletions(-) delete mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/verify.yaml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index dab2d88c..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,256 +0,0 @@ -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 - continue-on-error: true - run: | - npm run keeweb:generate - - # --------------------------------------------------------------------------------------- - # assign guid and uuid to env variable - # --------------------------------------------------------------------------------------- - - - name: "๐Ÿชช .ENV โ€บ Get" - id: task_initialize_dotenv_get - continue-on-error: true - uses: falti/dotenv-action@v1 - - # --------------------------------------------------------------------------------------- - # read back guid and uuid - # --------------------------------------------------------------------------------------- - - - name: "๐Ÿชช .ENV โ€บ Read" - id: task_dotenv_debug_print - continue-on-error: true - 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 }}' diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml new file mode 100644 index 00000000..da0886eb --- /dev/null +++ b/.github/workflows/verify.yaml @@ -0,0 +1,31 @@ +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