feat: update action to nodejs (#1159)
Co-authored-by: Tonye Jack <jtonye@ymail.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
131
.github/workflows/test.yml
vendored
131
.github/workflows/test.yml
vendored
@@ -24,9 +24,81 @@ jobs:
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.17
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'push'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
cache: 'yarn'
|
||||
node-version: '16.x'
|
||||
|
||||
- name: Create coverage directory and clover.xml
|
||||
run: |
|
||||
mkdir -p coverage
|
||||
touch coverage/clover.xml
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn install
|
||||
|
||||
- name: Run eslint on changed files
|
||||
uses: tj-actions/eslint-changed-files@v18
|
||||
with:
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
config_path: ".eslintrc.json"
|
||||
ignore_path: ".eslintignore"
|
||||
|
||||
- name: Run build and test
|
||||
run: |
|
||||
yarn all
|
||||
|
||||
- name: Verify Changed files
|
||||
uses: tj-actions/verify-changed-files@v14
|
||||
id: changed_files
|
||||
with:
|
||||
files: |
|
||||
src
|
||||
dist
|
||||
|
||||
- name: Commit files
|
||||
if: steps.changed_files.outputs.files_changed == 'true'
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add src dist
|
||||
git commit -m "Added missing changes and modified dist assets."
|
||||
|
||||
- name: Push changes
|
||||
if: steps.changed_files.outputs.files_changed == 'true'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.PAT_TOKEN }}
|
||||
branch: ${{ github.head_ref }}
|
||||
|
||||
- name: Upload build assets
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
path: dist
|
||||
|
||||
- name: Run codacy-coverage-reporter
|
||||
uses: codacy/codacy-coverage-reporter-action@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
coverage-reports: coverage/lcov.info
|
||||
|
||||
test-multiple-repositories:
|
||||
name: Test with multiple repositories
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout into dir1
|
||||
uses: actions/checkout@v3
|
||||
@@ -34,16 +106,24 @@ jobs:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
path: dir1
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with defaults on the dir1
|
||||
id: changed-files-dir1
|
||||
uses: ./dir1
|
||||
with:
|
||||
path: dir1
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir1.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in ${{ steps.changed-files-dir1.outputs.modified_files }}; do
|
||||
@@ -51,22 +131,26 @@ jobs:
|
||||
done
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: Checkout into dir2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
path: dir2
|
||||
|
||||
- name: Run changed-files with defaults on the dir2
|
||||
id: changed-files-dir2
|
||||
uses: ./dir2
|
||||
with:
|
||||
path: dir2
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir2.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
for file in ${{ steps.changed-files-dir2.outputs.modified_files }}; do
|
||||
@@ -77,6 +161,7 @@ jobs:
|
||||
|
||||
test-using-since-and-until:
|
||||
name: Test changed-files using since and until
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
|
||||
@@ -86,6 +171,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files since 2022-08-19
|
||||
id: changed-files-since
|
||||
uses: ./
|
||||
@@ -129,6 +219,7 @@ jobs:
|
||||
test-similar-base-and-commit-sha:
|
||||
name: Test changed-files similar base and commit sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
@@ -136,6 +227,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with similar base and commit sha
|
||||
id: changed-files
|
||||
continue-on-error: true
|
||||
@@ -159,6 +255,7 @@ jobs:
|
||||
test-unset-github-output-env:
|
||||
name: Test unset GITHUB_OUTPUT env
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
@@ -166,6 +263,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with unset GITHUB_OUTPUT env
|
||||
id: changed-files
|
||||
continue-on-error: true
|
||||
@@ -182,6 +284,7 @@ jobs:
|
||||
test-limited-commit-history:
|
||||
name: Test changed-files with limited commit history
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -195,6 +298,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
@@ -210,11 +318,17 @@ jobs:
|
||||
test-non-existent-base-sha:
|
||||
name: Test changed-files non existent base sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with non existent base sha
|
||||
id: changed-files
|
||||
uses: ./
|
||||
@@ -257,11 +371,17 @@ jobs:
|
||||
test-non-existent-sha:
|
||||
name: Test changed-files non existent sha
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with non existent sha
|
||||
id: changed-files
|
||||
uses: ./
|
||||
@@ -304,6 +424,7 @@ jobs:
|
||||
test-submodules:
|
||||
name: Test changed-files with submodule
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -318,6 +439,11 @@ jobs:
|
||||
submodules: recursive
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
|
||||
- name: Run changed-files with submodule
|
||||
id: changed-files
|
||||
uses: ./
|
||||
@@ -341,6 +467,7 @@ jobs:
|
||||
test:
|
||||
name: Test changed-files
|
||||
runs-on: ${{ matrix.platform }}
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 4
|
||||
@@ -354,6 +481,10 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: ${{ matrix.fetch-depth }}
|
||||
- name: Download build assets
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-assets
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
|
||||
Reference in New Issue
Block a user