Skip to content

Commit

Permalink
Merge pull request #90 from solidity-parser/ci
Browse files Browse the repository at this point in the history
CI
  • Loading branch information
fvictorio authored Aug 21, 2023
2 parents 2d1dbb9 + 549ca9e commit 4337742
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 38 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- **

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install
run: npm install
- name: lint
run: npm run lint

test_production:
name: Test production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install
run: npm install
- name: Build
run: npm run build
- name: Run integration
run: npm run test:integration
- name: Run tests
run: npm run test:browser

test_linux:
name: Test on Linux with Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 18, 20]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install
run: npm install
- name: Run tests
run: npm run test:node

test_macos:
name: Test on MacOS with Node 16
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install
run: npm install
- name: Run tests
run: npm run test:node

test_windows:
name: Test on Windows with Node 16
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Install
run: npm install
- name: Run tests
run: npm run test:node
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.github/
src/
test/
scripts/
.nyc_output/
.travis.yml
.gitmodules
.eslintrc
.editorconfig
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

35 changes: 12 additions & 23 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,58 @@
process.env.CHROME_BIN = require('puppeteer').executablePath()

module.exports = function(config) {
module.exports = function (config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],


// list of files / patterns to load in the browser
files: [
'dist/index.iife.js',
'browser-test/*.js'
],

files: ['dist/index.iife.js', 'browser-test/*.js'],

// list of files / patterns to exclude
exclude: [
],

exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},

preprocessors: {},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless'],

browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
},
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
concurrency: Infinity,
})
}
2 changes: 1 addition & 1 deletion test-integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const parser = require('..')
describe('integration', function () {
it('parses test file correctly', function () {
const content = fs.readFileSync(
path.join(__dirname, '..', 'test', 'test.sol')
path.join(__dirname, '..', 'antlr', 'test.sol')
)
parser.parse(content.toString())
})
Expand Down

0 comments on commit 4337742

Please sign in to comment.