internal: Only run typescript CI when VSCode files change

This commit is contained in:
Lukas Wirth 2023-03-30 09:59:08 +02:00
parent 5351c21b7e
commit 40adedcb96

View File

@ -18,6 +18,21 @@ env:
RUSTUP_MAX_RETRIES: 10 RUSTUP_MAX_RETRIES: 10
jobs: jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
typescript: ${{ steps.filter.outputs.typescript }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
typescript:
- 'editors/code/**'
rust: rust:
if: github.repository == 'rust-lang/rust-analyzer' if: github.repository == 'rust-lang/rust-analyzer'
name: Rust name: Rust
@ -102,6 +117,7 @@ jobs:
done done
typescript: typescript:
needs: changes
if: github.repository == 'rust-lang/rust-analyzer' if: github.repository == 'rust-lang/rust-analyzer'
name: TypeScript name: TypeScript
strategy: strategy:
@ -114,18 +130,21 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
if: needs.changes.outputs.typescript == 'true'
- name: Install Nodejs - name: Install Nodejs
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
if: needs.changes.outputs.typescript == 'true'
- name: Install xvfb - name: Install xvfb
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
run: sudo apt-get install -y xvfb run: sudo apt-get install -y xvfb
- run: npm ci - run: npm ci
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; } # - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
# if: runner.os == 'Linux' # if: runner.os == 'Linux'
@ -133,16 +152,17 @@ jobs:
- run: npm run lint - run: npm run lint
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
- name: Run VS Code tests (Linux) - name: Run VS Code tests (Linux)
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
env: env:
VSCODE_CLI: 1 VSCODE_CLI: 1
run: xvfb-run npm test run: xvfb-run npm test
working-directory: ./editors/code working-directory: ./editors/code
- name: Run VS Code tests (Windows) - name: Run VS Code tests (Windows)
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
env: env:
VSCODE_CLI: 1 VSCODE_CLI: 1
run: npm test run: npm test
@ -150,9 +170,11 @@ jobs:
- run: npm run pretest - run: npm run pretest
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
- run: npm run package --scripts-prepend-node-path - run: npm run package --scripts-prepend-node-path
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
end-success: end-success:
name: bors build finished name: bors build finished
@ -165,7 +187,7 @@ jobs:
end-failure: end-failure:
name: bors build finished name: bors build finished
if: github.event.pusher.name == 'bors' && (failure() || cancelled()) if: github.event.pusher.name == 'bors' && !success()
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [rust, rust-cross, typescript] needs: [rust, rust-cross, typescript]
steps: steps: