Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

ci(win): setup GH actions for windows CI (#4402)

JeongHoon Byun (a.k.a Outsider)28f970e37211
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 25a84622..9db68640 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -58,7 +58,7 @@ Follow these steps to get going. If you are having trouble, don't be afraid to [
- Keep your PR focused. Don't fix two things at once; don't upgrade dependencies unless necessary.
1. Before committing, run `npm start test`.
- This will run both Node.js-based and browser-based tests.
- - Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha)). The first step to ensuring these checks pass is to test on your own machine.
+ - Ultimately, your pull request will be built on our continuous integration servers ([Travis CI](https://travis-ci.org/mochajs/mocha) and [GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Windows+CI%22)). The first step to ensuring these checks pass is to test on your own machine.
- A coverage check will be sent to [Coveralls](https://coveralls.io/github/mochajs/mocha). **A drop in code coverage % is considered a failed check**.
1. Commit your changes.
- Use a brief message on the first line, referencing a relevant issue (e.g. `closes #12345`).
diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml
new file mode 100644
index 00000000..3bc1fa70
--- /dev/null
+++ b/.github/workflows/windows-ci.yml
@@ -0,0 +1,95 @@
+name: Windows CI
+on: [push, pull_request]
+
+jobs:
+ prepare-commit-msg:
+ name: Retrive head commit message
+ runs-on: ubuntu-latest
+ outputs:
+ HEAD_COMMIT_MSG: ${{ steps.commitMsg.outputs.HEAD_COMMIT_MSG }}
+ steps:
+ - uses: actions/checkout@v1
+ if: github.event_name == 'pull_request'
+ - name: find commit msg for PR
+ id: commitMsg
+ if: github.event_name == 'pull_request'
+ run: echo "::set-output name=HEAD_COMMIT_MSG::$(git log --no-merges -1 --oneline)"
+ check-skip:
+ name: Check to skip CI
+ needs: prepare-commit-msg
+ runs-on: ubuntu-latest
+ if: ${{ !contains(github.event.head_commit.message, '[ci skip]') && !contains(needs.prepare-commit-msg.outputs.HEAD_COMMIT_MSG, '[ci skip]') }}
+ steps:
+ - run: echo "${{ github.event.head_commit.message }}"
+ smoke:
+ name: Smoke on Node.js v${{ matrix.node }}
+ needs: check-skip
+ runs-on: windows-2019
+ strategy:
+ matrix:
+ node: [10, 12, 14]
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node }}
+ - run: npm install --production
+ - run: ./bin/mocha --no-config --reporter spec test/smoke/smoke.spec.js
+ prepare:
+ name: Install dependencies
+ runs-on: windows-2019
+ needs: smoke
+ steps:
+ - name: Cache Growl Installer
+ id: cache-growl
+ uses: actions/cache@v2
+ with:
+ path: GrowlInstaller
+ key: ${{ runner.os }}-growl-installer
+ restore-keys: |
+ ${{ runner.os }}-growl-installer
+ - name: Download Growl Installer
+ if: steps.cache-growl.outputs.cache-hit != 'true'
+ run: |
+ echo "Installing Growl..."
+ mkdir GrowlInstaller | out-null
+ $seaURL = "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe"
+ $seaPath = "GrowlInstaller\GrowlInstaller.exe"
+ $webclient = New-Object Net.WebClient
+ $webclient.DownloadFile($seaURL, $seaPath)
+ 7z x $seaPath -oGrowlInstaller | out-null
+ test:
+ name: Test on Node.js v${{ matrix.node }}
+ needs: prepare
+ runs-on: windows-2019
+ strategy:
+ matrix:
+ node: [10, 12, 14]
+ steps:
+ - name: Restore Growl Installer
+ uses: actions/cache@v2
+ with:
+ path: GrowlInstaller
+ key: ${{ runner.os }}-growl-installer
+ restore-keys: |
+ ${{ runner.os }}-growl-installer
+ - run: echo "::add-path::C:\Program Files (x86)\Growl for Windows"
+ - name: Install Growl
+ run: |
+ echo "Installing Growl"
+ cmd /c start /wait msiexec /i GrowlInstaller\Growl_v2.0.msi /quiet
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node }}
+ - run: npm ci --ignore-scripts
+ - name: npm start test.node
+ run: |
+ echo "Starting Growl service..."
+ Start-Process -NoNewWindow Growl
+ ## Growl requires some time before it's ready to handle notifications
+ echo "Verifying Growl responding"
+ Start-Sleep -s 5
+ growlnotify test
+ echo "Staring test"
+ npm start test.node
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index b1f8058d..37fc0b22 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -346,7 +346,7 @@ _It's easier to release often._
1. These changes are then added to the Git "stage" and will be added to the commit.
1. Push `master` to `origin` with your new tag; e.g. `git push origin master --tags`
1. Copy & paste the `CHANGELOG.md` lines to a new GitHub "release". Save release as draft.
-1. Meanwhile, you can check [the build](https://travis-ci.org/mochajs/mocha) on Travis-CI and [AppVeyor](https://ci.appveyor.com/project/boneskull/mocha).
+1. Meanwhile, you can check [the build](https://travis-ci.org/mochajs/mocha) on Travis-CI and [GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Windows+CI%22).
1. Once the build is green, you'll want to trigger an update of `mochajs.org`:
1. _If you're doing a prerelease_, fast-forward the `next` branch to `master`, and push it. This updates [https://next.mochajs.org](https://next.mochajs.org). That's all.
1. _If this is NOT a prerelease_, fast-forward the `mochajs.org` branch to `master` and push it. This updates [https://mochajs.org](https://mochajs.org).
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 5cda1af0..00000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-###
-### appveyor.yml
-###
-
-## General configuration
-version: '{build}'
-skip_commits:
- message: /\[ci\s+skip\]/
-
-## Environment configuration
-shallow_clone: true
-clone_depth: 1
-environment:
- matrix:
- - nodejs_version: '14'
- - nodejs_version: '12'
- - nodejs_version: '10'
-matrix:
- fast_finish: true
-install:
- ## Manual Growl install
- - ps: Add-AppveyorMessage "Installing Growl..."
- - ps: $seaURL = "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe"
- - ps: $seaPath = "$($env:USERPROFILE)\GrowlInstaller.exe"
- - ps: $webclient = New-Object Net.WebClient
- - ps: $webclient.DownloadFile($seaURL, $seaPath)
- - ps: mkdir C:\GrowlInstaller | out-null
- - ps: 7z x $seaPath -oC:\GrowlInstaller | out-null
- - ps: cmd /c start /wait msiexec /i C:\GrowlInstaller\Growl_v2.0.msi /quiet
- - ps: $env:path = "C:\Program Files (x86)\Growl for Windows;$env:path"
- ## Growl requires some time before it's ready to handle notifications
- - ps: Add-AppveyorMessage "Starting Growl service..."
- - ps: Start-Process -NoNewWindow Growl
- ## Node-related installs
- - ps: Add-AppveyorMessage "Installing Node..."
- - set PATH=%APPDATA%\npm;C:\MinGW\bin;%PATH%
- ## Prefer pre-installed Node versions, with fallback to manual update
- - ps: |
- try {
- Install-Product node $env:nodejs_version $env:platform
- } catch {
- Add-AppveyorMessage " install failed - attempting manual update..."
- Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform
- }
- - ps: Add-AppveyorMessage "Installing npm..."
- - npm install -g npm
- ## Mocha-related package installs
- - ps: Add-AppveyorMessage "Installing Mocha dependencies..."
- - npm ci --ignore-scripts
-
-## Build configuration
-platform:
- - x64
-build: script
-build_script:
- - ps: Add-AppveyorMessage "Verify Growl responding..."
- - ps: growlnotify test
-
-## Test configuration
-before_test:
- - set CI=true
-test_script:
- - ps: Add-AppveyorMessage "Displaying version information"
- - ps: (Get-ComputerInfo -Property OsName,OsVersion,OsArchitecture | Format-Table -HideTableHeaders -AutoSize | Out-String).Trim()
- - node --version
- - npm --version
- - ps: Add-AppveyorMessage "Running tests..."
- - npm start test.node
- - ps: Add-AppveyorMessage "Done"
-
-## Notifications
-notifications:
- - provider: Email
- on_build_success: false
- on_build_failure: false
- on_build_status_changed: false
diff --git a/karma.conf.js b/karma.conf.js
index 78517206..8379c1bc 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -104,7 +104,7 @@ module.exports = config => {
throw new Error('no browser tests should run on AppVeyor!');
} else {
console.error(`Local environment (${hostname}) detected`);
- // don't need to run sauce from appveyor b/c travis does it.
+ // don't need to run sauce from Windows CI b/c travis does it.
if (env.SAUCE_USERNAME || env.SAUCE_ACCESS_KEY) {
const id = `${hostname} (${Date.now()})`;
sauceConfig = {