From 072aba6f3646d359fe1b5a33b0a87806450a39a5 Mon Sep 17 00:00:00 2001 From: Antoine Aflalo Date: Sun, 27 Mar 2022 13:40:59 -0400 Subject: [PATCH] chore(Pipeline): Add github action code BREAKING CHANGE: Moving to VueJS 3 --- .github/.kodiak.toml | 14 ++++ .github/dependabot.yml | 24 +++++++ .github/workflows/codeql-analysis.yml | 67 ++++++++++++++++++ .github/workflows/nodejs.yml | 97 +++++++++++++++++++++++++++ .travis.yml | 37 ---------- package.json | 3 +- vite.config.js | 4 +- yarn.lock | 2 +- 8 files changed, 208 insertions(+), 40 deletions(-) create mode 100644 .github/.kodiak.toml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/nodejs.yml delete mode 100644 .travis.yml diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml new file mode 100644 index 0000000..b7f6328 --- /dev/null +++ b/.github/.kodiak.toml @@ -0,0 +1,14 @@ +# Minimal config. version is the only required field. +version = 1 +[merge] +automerge_label = "ship it!" + +[merge.automerge_dependencies] +# auto merge all PRs opened by "dependabot" that are "minor" or "patch" version upgrades. "major" version upgrades will be ignored. +versions = ["minor", "patch"] +usernames = ["dependabot"] + +# if using `update.always`, add dependabot to `update.ignore_usernames` to allow +# dependabot to update and close stale dependency upgrades. +[update] +ignored_usernames = ["dependabot"] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e7bf9d7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,24 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + labels: + - "dependencies" + # Add Kodiak `merge.automerge_label` + - "ship it!" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" + labels: + - "dependencies" + # Add Kodiak `merge.automerge_label` + - "ship it!" \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..9bc3979 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ develop, master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ develop ] + schedule: + - cron: '23 12 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..00d7c6a --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,97 @@ +name: NodeJs +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{secrets.NPM_TOKEN }} + NODEJS: 16 + YARN_CACHE: "yarn-cache" + +on: + push: + branches: [ develop, master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ develop, master ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node: [ '14', '16' ] + steps: + - uses: actions/checkout@v3 + - name: Set yarn cache + run: yarn config set cache-folder ${{env.YARN_CACHE}} + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: yarn + with: + path: ${{env.YARN_CACHE}} + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Setup Node.js ${{ matrix.node }} + uses: actions/setup-node@v3.0.0 + with: + node-version: ${{ matrix.node }} + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Run tests + run: yarn test + - name: Upload code coverage + uses: codecov/codecov-action@v2.1.0 + with: + fail_ci_if_error: true # optional (default = false) + deploy-pages: + needs: build + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set yarn cache + run: yarn config set cache-folder ${{env.YARN_CACHE}} + - name: Setup Node.js + uses: actions/setup-node@v3.0.0 + with: + node-version: ${{env.NODEJS}} + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: yarn + with: + path: ${{env.YARN_CACHE}} + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install semantic-release dependencies + run: yarn install --frozen-lockfile + - name: Build package + run: yarn build:example + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + branch: gh-pages # The branch the action should deploy to. + folder: docs # The folder the action should deploy. + + release: + needs: build + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set yarn cache + run: yarn config set cache-folder ${{env.YARN_CACHE}} + - name: Setup Node.js + uses: actions/setup-node@v3.0.0 + with: + node-version: ${{env.NODEJS}} + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: yarn + with: + path: ${{env.YARN_CACHE}} + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install semantic-release dependencies + run: yarn install --frozen-lockfile + - name: Build package + run: yarn build + - name: Release + run: yarn semantic-release + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 95fed11..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: node_js -sudo: true -node_js: - - 16 -cache: - yarn: true - directories: - - node_modules -stages: - - test - - name: deploy - if: branch = master && type = push -jobs: - include: - - stage: test - script: - - yarn test - - stage: deploy - install: true - before_install: - - 'curl -H "Cache-Control: no-cache" https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash' - script: - - yarn build:example - after_success: - - fossa - deploy: - provider: pages - skip-cleanup: true - github-token: "$GH_TOKEN" - local-dir: docs - on: - branch: master - - script: - - yarn build - - yarn semantic-release - after_success: skip - before_script: skip diff --git a/package.json b/package.json index ee344e0..a83ad1c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "commitmsg": "validate-commit-msg", "dev": "vite", "semantic-release": "semantic-release", - "test": "jest" + "test": "jest", + "buid:example": "vite build" }, "main": "dist/vue-json-csv.common.js", "files": [ diff --git a/vite.config.js b/vite.config.js index 3816e78..eef5b67 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,5 +9,7 @@ export default defineConfig({ }, root: 'example', base: './', - publicDir: 'docs' + build: { + outDir: '../docs' + } }) diff --git a/yarn.lock b/yarn.lock index 2444036..48de969 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7021,7 +7021,7 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^7.0: +husky@^7.0.0: version "7.0.4" resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535" integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==