|
| 1 | +name: Native and WSL |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + defaults: |
| 9 | + run: |
| 10 | + shell: ${{ matrix.configuration == 'wsl' && 'wsl-bash {0}' || 'pwsh' }} |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + os: [windows-2019] |
| 15 | + node-version: [18, 16, 14, 12, 10, 8, 6, 4] |
| 16 | + configuration: [wsl, native] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: Vampire/setup-wsl@v3 |
| 21 | + if: matrix.configuration == 'wsl' |
| 22 | + with: |
| 23 | + distribution: Ubuntu-22.04 |
| 24 | + - run: curl --version |
| 25 | + - name: 'WSL: do all npm install steps' |
| 26 | + if: matrix.configuration == 'wsl' |
| 27 | + env: |
| 28 | + ESLINT_VERSION: 7 |
| 29 | + TRAVIS_NODE_VERSION: ${{ matrix.node-version }} |
| 30 | + run: | |
| 31 | + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash |
| 32 | + export NVM_DIR="$HOME/.nvm" |
| 33 | + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm |
| 34 | + nvm install --latest-npm ${{ matrix.node-version }} |
| 35 | +
|
| 36 | + if [ ${{ matrix.node-version }} -ge 4 ] && [ ${{ matrix.node-version }} -lt 6 ]; then |
| 37 | + npm install eslint@4 --no-save --ignore-scripts |
| 38 | + npm install |
| 39 | + npm install eslint-import-resolver-typescript@1.0.2 --no-save |
| 40 | + npm uninstall @angular-eslint/template-parser @typescript-eslint/parser --no-save |
| 41 | + fi |
| 42 | + if [ ${{ matrix.node-version }} -ge 6 ] && [ ${{ matrix.node-version }} -lt 7 ]; then |
| 43 | + npm install eslint@5 --no-save --ignore-scripts |
| 44 | + npm install |
| 45 | + npm uninstall @angular-eslint/template-parser --no-save |
| 46 | + npm install eslint-import-resolver-typescript@1.0.2 @typescript-eslint/parser@3 --no-save |
| 47 | + fi |
| 48 | + if [ ${{ matrix.node-version }} -ge 7 ] && [ ${{ matrix.node-version }} -lt 8 ]; then |
| 49 | + npm install eslint@6 --no-save --ignore-scripts |
| 50 | + npm install |
| 51 | + npm install eslint-import-resolver-typescript@1.0.2 typescript-eslint-parser@20 --no-save |
| 52 | + npm uninstall @angular-eslint/template-parser --no-save |
| 53 | + fi |
| 54 | + if [ ${{ matrix.node-version }} -eq 8 ]; then |
| 55 | + npm install eslint@6 --no-save --ignore-scripts |
| 56 | + npm install |
| 57 | + npm uninstall @angular-eslint/template-parser --no-save |
| 58 | + npm install @typescript-eslint/parser@3 --no-save |
| 59 | + fi |
| 60 | + if [ ${{ matrix.node-version }} -gt 8 ] && [ ${{ matrix.node-version }} -lt 10 ]; then |
| 61 | + npm install eslint@7 --no-save --ignore-scripts |
| 62 | + npm install |
| 63 | + npm install @typescript-eslint/parser@3 --no-save |
| 64 | + fi |
| 65 | + if [ ${{ matrix.node-version }} -ge 10 ] && [ ${{ matrix.node-version }} -lt 12 ]; then |
| 66 | + npm install |
| 67 | + npm install @typescript-eslint/parser@4 --no-save |
| 68 | + fi |
| 69 | + if [ ${{ matrix.node-version }} -ge 12 ]; then |
| 70 | + npm install |
| 71 | + fi |
| 72 | + npm run copy-metafiles |
| 73 | + npm run pretest |
| 74 | + npm run tests-only |
| 75 | +
|
| 76 | + - name: install dependencies for node <= 10 |
| 77 | + if: matrix.node-version <= '10' && matrix.configuration == 'native' |
| 78 | + run: | |
| 79 | + npm install --legacy-peer-deps |
| 80 | + npm install eslint@7 --no-save |
| 81 | +
|
| 82 | + - name: Install dependencies for node > 10 |
| 83 | + if: matrix.node-version > '10' && matrix.configuration == 'native' |
| 84 | + run: npm install |
| 85 | + |
| 86 | + - name: install the latest version of nyc |
| 87 | + if: matrix.configuration == 'native' |
| 88 | + run: npm install nyc@latest --no-save |
| 89 | + |
| 90 | + - name: copy metafiles for node <= 8 |
| 91 | + if: matrix.node-version <= 8 && matrix.configuration == 'native' |
| 92 | + env: |
| 93 | + ESLINT_VERSION: 6 |
| 94 | + TRAVIS_NODE_VERSION: ${{ matrix.node-version }} |
| 95 | + run: | |
| 96 | + npm run copy-metafiles |
| 97 | + bash ./tests/dep-time-travel.sh 2>&1 |
| 98 | + - name: copy metafiles for Node > 8 |
| 99 | + if: matrix.node-version > 8 && matrix.configuration == 'native' |
| 100 | + env: |
| 101 | + ESLINT_VERSION: 7 |
| 102 | + TRAVIS_NODE_VERSION: ${{ matrix.node-version }} |
| 103 | + run: | |
| 104 | + npm run copy-metafiles |
| 105 | + bash ./tests/dep-time-travel.sh 2>&1 |
| 106 | +
|
| 107 | + - name: install ./resolver dependencies in Native |
| 108 | + if: matrix.configuration == 'native' |
| 109 | + shell: pwsh |
| 110 | + run: | |
| 111 | + npm config set package-lock false |
| 112 | + $resolverDir = "./resolvers" |
| 113 | + Get-ChildItem -Directory $resolverDir | |
| 114 | + ForEach { |
| 115 | + Write-output $(Resolve-Path $(Join-Path $resolverDir $_.Name)) |
| 116 | + Push-Location $(Resolve-Path $(Join-Path $resolverDir $_.Name)) |
| 117 | + npm install |
| 118 | + npm ls nyc > $null; |
| 119 | + if ($?) { |
| 120 | + npm install nyc@latest --no-save |
| 121 | + } |
| 122 | + Pop-Location |
| 123 | + } |
| 124 | +
|
| 125 | + - name: run tests in Native |
| 126 | + if: matrix.configuration == 'native' |
| 127 | + shell: pwsh |
| 128 | + run: | |
| 129 | + npm run pretest |
| 130 | + npm run tests-only |
| 131 | + $resolverDir = "./resolvers"; |
| 132 | + $resolvers = @(); |
| 133 | + Get-ChildItem -Directory $resolverDir | |
| 134 | + ForEach { |
| 135 | + $resolvers += "$(Resolve-Path $(Join-Path $resolverDir $_.Name))"; |
| 136 | + } |
| 137 | + $env:RESOLVERS = [string]::Join(";", $resolvers); |
| 138 | + foreach ($resolver in $resolvers) { |
| 139 | + Set-Location -Path $resolver.Trim('"') |
| 140 | + npm run tests-only |
| 141 | + Set-Location -Path $PSScriptRoot |
| 142 | + } |
| 143 | +
|
| 144 | + - name: codecov |
| 145 | + uses: codecov/codecov-action@v3.1.5 |
| 146 | + |
| 147 | + windows: |
| 148 | + runs-on: ubuntu-latest |
| 149 | + needs: [build] |
| 150 | + steps: |
| 151 | + - run: true |
0 commit comments