diff --git a/.github/workflows/basic-validation.yml b/.github/workflows/basic-validation.yml new file mode 100644 index 000000000..5e5029a9f --- /dev/null +++ b/.github/workflows/basic-validation.yml @@ -0,0 +1,17 @@ +name: Basic validation + +on: + pull_request: + paths-ignore: + - '**.md' + push: + branches: + - main + - releases/* + paths-ignore: + - '**.md' + +jobs: + call-basic-validation: + name: Basic validation + uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main \ No newline at end of file diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 91e3b88ae..1251c11d9 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -1,8 +1,3 @@ -# `dist/index.js` is a special file in Actions. -# When you reference an action with `uses:` in a workflow, -# `index.js` is the code that will run. -# For our project, we generate this file through a build process from other source files. -# We need to make sure the checked-in `index.js` actually matches what we expect it to be. name: Check dist/ on: @@ -17,36 +12,6 @@ on: workflow_dispatch: jobs: - check-dist: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set Node.js 16 - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: npm - - - name: Install dependencies - run: npm ci --ignore-scripts - - - name: Rebuild the dist/ directory - run: npm run build - - - name: Compare the expected and actual dist/ directories - run: | - if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then - echo "Detected uncommitted changes after build. See status below:" - git diff - exit 1 - fi - id: diff - - # If index.js was different than expected, upload the expected version as an artifact - - uses: actions/upload-artifact@v3 - if: ${{ failure() && steps.diff.conclusion == 'failure' }} - with: - name: dist - path: dist/ + call-check-dist: + name: Check dist/ + uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d21db3568..f1f430a8f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,70 +1,14 @@ -# 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" +name: CodeQL analysis on: push: branches: [ main ] pull_request: - # The branches below must be a subset of the branches above branches: [ main ] schedule: - - cron: '23 19 * * 0' + - cron: '0 3 * * 0' jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - 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@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # ✏ī¸ 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@v2 + call-codeQL-analysis: + name: CodeQL analysis + uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main \ No newline at end of file diff --git a/.github/workflows/workflow.yml b/.github/workflows/e2e-tests.yml similarity index 93% rename from .github/workflows/workflow.yml rename to .github/workflows/e2e-tests.yml index 3116a6e2f..b6cda4cc5 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,4 +1,4 @@ -name: Main workflow +name: e2e tests on: pull_request: @@ -12,28 +12,6 @@ on: - '**.md' jobs: - build: - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - operating-system: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set Node.js 16 - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: npm - - run: npm ci --ignore-scripts - - run: npm run build - - run: npm run format-check - - run: npm test - - name: Verify no unstaged changes - if: runner.os != 'windows' - run: __tests__/verify-no-unstaged-changes.sh - test-setup-multiple-versions: runs-on: ${{ matrix.operating-system }} strategy: @@ -342,4 +320,4 @@ jobs: env: NUGET_AUTH_TOKEN: NOTATOKEN - name: Verify dotnet - run: __tests__/verify-dotnet.sh 3.1.201 + run: __tests__/verify-dotnet.sh 3.1.201 \ No newline at end of file diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index d8fb6ea57..42084b23b 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -10,16 +10,6 @@ on: workflow_dispatch: jobs: - test: - runs-on: ubuntu-latest - name: Check licenses - steps: - - uses: actions/checkout@v3 - - run: npm ci --ignore-scripts - - name: Install licensed - run: | - cd $RUNNER_TEMP - curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz - sudo tar -xzf licensed.tar.gz - sudo mv licensed /usr/local/bin/licensed - - run: licensed status + call-licensed: + name: Licensed + uses: actions/reusable-workflows/.github/workflows/licensed.yml@main \ No newline at end of file diff --git a/.github/workflows/release-new-action-version.yml b/.github/workflows/release-new-action-version.yml index 1d0fb7f97..e43ef52ee 100644 --- a/.github/workflows/release-new-action-version.yml +++ b/.github/workflows/release-new-action-version.yml @@ -1,4 +1,5 @@ name: Release new action version + on: release: types: [released] @@ -25,4 +26,4 @@ jobs: uses: actions/publish-action@v0.2.1 with: source-tag: ${{ env.TAG_NAME }} - slack-webhook: ${{ secrets.SLACK_WEBHOOK }} + slack-webhook: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/__tests__/verify-no-unstaged-changes.sh b/__tests__/verify-no-unstaged-changes.sh deleted file mode 100755 index 15efefe7a..000000000 --- a/__tests__/verify-no-unstaged-changes.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then - echo "Detected uncommitted changes after build. See status below:" - git diff - exit 1 -fi diff --git a/package.json b/package.json index 6e80f1a1c..b1cd5636b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "tsc && ncc build", "format": "prettier --write **/*.ts", "format-check": "prettier --check **/*.ts", + "lint": "echo \"Fake command that does nothing. It is used in reusable workflows\"", "prepare": "husky install", "test": "jest --coverage --config ./jest.config.js", "update-installers": "nwget https://dot.net/v1/dotnet-install.ps1 -O externals/install-dotnet.ps1 && nwget https://dot.net/v1/dotnet-install.sh -O externals/install-dotnet.sh"