mirror of
https://github.com/jquery/sizzle.git
synced 2025-12-28 04:43:44 +00:00
Tests: Migrate from Travis to GitHub Actions
Closes gh-482
This commit is contained in:
parent
20390f0573
commit
ede0e97563
38
.github/workflows/node.js.yml
vendored
Normal file
38
.github/workflows/node.js.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
NODE_VERSION: '16.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
|
||||
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2.1.2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
|
||||
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
|
||||
run: |
|
||||
export PATH=${HOME}/firefox:$PATH
|
||||
npm test
|
||||
@ -1,7 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '12'
|
||||
env:
|
||||
global:
|
||||
- secure: UzENy1srzIScquAja5376P0dj4X6DJsskYrQjUtRpi6tvCtpx80DiFjFAY6JKUMw/BHuugABkBmP0q5o3kMbp2y6mZO0qg+CBUZ8MX/UipNv0/xWbP7ckayLXU7RvICTObfJ0bGwF5uxxoCUBJjoKFZ0YZH94Orq8XQgC8wbNMk=
|
||||
- secure: EfY8wLmtbx+VH+sE0E3jRUP6hp78WjjumuWfhfB9R7+bRMhaj9kSVo+ReKQ5GExnJlm5DtU84fmDujO9gIDDgmZZ2/83PRJ5URSEXRCiyS8A82e4cw0Jz1NuU/nzUdv+gGwhdcYlKO3oTf39tPAvuxXWIwNcKddg9/NGAAZdUXI=
|
||||
@ -3,7 +3,7 @@
|
||||
var grunt = require( "grunt" );
|
||||
|
||||
module.exports = function( config ) {
|
||||
var isTravis = process.env.TRAVIS,
|
||||
var isCi = process.env.GITHUB_ACTION,
|
||||
dateString = grunt.config( "dateString" ),
|
||||
isBrowserStack = !!( process.env.BROWSER_STACK_USERNAME &&
|
||||
process.env.BROWSER_STACK_ACCESS_KEY ),
|
||||
@ -70,10 +70,10 @@ module.exports = function( config ) {
|
||||
// Add BrowserStack launchers
|
||||
customLaunchers: require( "./launchers" ),
|
||||
|
||||
// Make travis output less verbose
|
||||
reporters: isTravis ? "dots" : "progress",
|
||||
// Make GitHub Actions output less verbose
|
||||
reporters: isCi ? "dots" : "progress",
|
||||
|
||||
colors: !isTravis,
|
||||
colors: !isCi,
|
||||
|
||||
hostname: hostName,
|
||||
port: 9876,
|
||||
@ -93,16 +93,16 @@ module.exports = function( config ) {
|
||||
browserDisconnectTolerance: 3
|
||||
} );
|
||||
|
||||
// Deal with Travis environment
|
||||
if ( isTravis ) {
|
||||
|
||||
// Browserstack launcher specifies "build" options as a default value
|
||||
// of "TRAVIS_BUILD_NUMBER" variable, but this way a bit more verbose
|
||||
config.browserStack.build = "travis #" + process.env.TRAVIS_BUILD_NUMBER;
|
||||
// Deal with the GitHub Actions environment
|
||||
if ( isCi ) {
|
||||
config.browserStack.build = "Sizzle GitHub #" + process.env.GITHUB_RUN_NUMBER;
|
||||
|
||||
// You can't get access to secure environment variables from pull requests
|
||||
// so we don't have browserstack from them, but travis has headless Firefox so use that
|
||||
if ( !isBrowserStack && process.env.TRAVIS_PULL_REQUEST ) {
|
||||
// so we don't have browserstack from them, but GitHub Actions have headless
|
||||
// Firefox so use that.
|
||||
// The `GITHUB_BASE_REF` env variable is only available on PRs, see:
|
||||
// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||
if ( !isBrowserStack && process.env.GITHUB_BASE_REF ) {
|
||||
config.browsers.push( "FirefoxHeadless" );
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user