Skip to content

Commit

Permalink
Merge pull request #245 from optimizely/EC3-1545-gha-migration
Browse files Browse the repository at this point in the history
EC3-1545 migrate from travis.yml to GHA
  • Loading branch information
alexjoeyyong authored Jan 23, 2025
2 parents 102fe39 + 6d07168 commit 593b003
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 131 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/nodejs-ci.yml
name: Run Tests for Nuclear JS

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4

# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.18.1

# Install grunt-cli globally
- name: Install grunt-cli
run: npm install -g grunt-cli

# Install dependencies
- name: Install dependencies
run: npm install

# Run tests
- name: Run tests
run: grunt ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
coverage/
package-lock.json
26 changes: 20 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
module.exports = function(grunt) {
require('load-grunt-config')(grunt)
// load npm tasks
grunt.loadNpmTasks('grunt-karma')
grunt.loadNpmTasks('grunt-karma-coveralls')
}
module.exports = function (grunt) {
// Load grunt configurations
require('load-grunt-config')(grunt, {
configPath: require('path').join(__dirname, 'grunt'),
init: true,
});

// Load npm tasks
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls');

// Default task for Chrome and Firefox
grunt.registerTask('test', ['karma:chrome', 'karma:firefox']);

// Separate task for Chrome only
grunt.registerTask('test:chrome', ['karma:chrome']);

// Separate task for Firefox only
grunt.registerTask('test:firefox', ['karma:firefox']);
};
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
[![Coverage Status](https://coveralls.io/repos/optimizely/nuclear-js/badge.svg?branch=master)](https://coveralls.io/r/optimizely/nuclear-js?branch=master)
[![Join the chat at https://gitter.im/optimizely/nuclear-js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/optimizely/nuclear-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/nuclearjs.svg)](https://saucelabs.com/u/nuclearjs)

Traditional Flux architecture built with ImmutableJS data structures.

## Documentation
Expand Down
File renamed without changes.
11 changes: 3 additions & 8 deletions grunt/aliases.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
module.exports = {
'test': [
'karma:phantom',
'karma:chrome',
'karma:firefox',
],

'sauce': [
'karma:sauce_modern',
'karma:sauce_ie',
'karma:sauce_mobile',
],

'ci': [
'eslint',
'clean:coverage',
'karma:coverage',
'coveralls',
//'sauce', TODO: investigate why sauce connect isnt working
// 'coveralls', //doesn't seem to be a thing anymore.
],
}
49 changes: 25 additions & 24 deletions grunt/karma.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
var sauce = require('./sauce')
var path = require('path')

module.exports = {
options: {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: path.join(__dirname, '../'),
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],

// list of files / patterns to load in the browser
Expand Down Expand Up @@ -43,22 +41,37 @@ module.exports = {
},
},

phantom: {
frameworks: ['jasmine', 'es5-shim'],
browsers: ['PhantomJS'],
chrome: {
frameworks: ['jasmine'],
reporters: ['progress', 'html'],
browsers: ['ChromeHeadless'], // Use ChromeHeadless for CI
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu'], // Required for CI environments
},
},
autoWatch: false,
singleRun: true,
},

chrome: {
reporters: ['html'],
browsers: ['Chrome'],
autoWatch: true,
singleRun: false,
firefox: {
frameworks: ['jasmine'],
reporters: ['progress', 'html'],
browsers: ['FirefoxHeadless'], // Use FirefoxHeadless for CI
customLaunchers: {
HeadlessFirefox: {
base: 'FirefoxHeadless',
},
},
autoWatch: false,
singleRun: true,
},

coverage: {
frameworks: ['jasmine', 'es5-shim'],
frameworks: ['jasmine'],
reporters: ['progress', 'coverage'],
browsers: ['PhantomJS'],
browsers: ['ChromeHeadless', 'FirefoxHeadless'], // Run tests on both browsers for coverage
coverageReporter: {
reporters: [
{ type: 'html', dir: 'coverage/' },
Expand All @@ -82,16 +95,4 @@ module.exports = {
},
},
},

sauce_modern: {
options: sauce.modern,
},

sauce_ie: {
options: sauce.ie,
},

sauce_mobile: {
options: sauce.mobile,
},
}
85 changes: 0 additions & 85 deletions grunt/sauce.js

This file was deleted.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,17 @@
"jstransform": "^11.0.1",
"jstransform-loader": "^0.2.0",
"karma": "^0.13.3",
"karma-chrome-launcher": "^0.2.0",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.4.2",
"karma-es5-shim": "https://github.com/pokehanai/karma-es5-shim/archive/v2.1.0.tar.gz",
"karma-firefox-launcher": "^2.1.3",
"karma-jasmine": "^0.3.6",
"karma-jasmine-html-reporter": "^0.1.8",
"karma-phantomjs-launcher": "^0.2.0",
"karma-sauce-launcher": "^0.2.14",
"karma-webpack": "^1.7.0",
"load-grunt-config": "^0.17.1",
"lodash": "^4.17.11",
"node-libs-browser": "^0.5.2",
"phantomjs": "^1.9.17",
"puppeteer": "^24.1.0",
"react": "^0.13.3",
"webpack": "^1.10.5"
}
Expand Down
2 changes: 1 addition & 1 deletion src/reactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ConsoleGroupLogger } from './logging'
import { isKeyPath } from './key-path'
import { isGetter } from './getter'
import { toJS } from './immutable-helpers'
import { extend, toFactory } from './utils'
import { toFactory } from './utils'
import {
ReactorState,
ObserverState,
Expand Down
2 changes: 1 addition & 1 deletion tests/reactor-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Reactor, Store } from '../src/main'
import { getOption } from '../src/reactor/fns'
import { toImmutable } from '../src/immutable-helpers'
import { PROD_OPTIONS, DEBUG_OPTIONS } from '../src/reactor/records'
import { NoopLogger, ConsoleGroupLogger } from '../src/logging'
import { ConsoleGroupLogger } from '../src/logging'

describe('Reactor', () => {
it('should construct without \'new\'', () => {
Expand Down

0 comments on commit 593b003

Please sign in to comment.