Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: removed travis and added automated tests via github workflow #412

Merged
merged 6 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# prevent github actions to checkout files with crlf line endings
* -text
11 changes: 9 additions & 2 deletions .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,28 @@ jobs:
name: Test on Linux with Node ${{ matrix.node }}
strategy:
matrix:
node: [14, 16]
node: [14, 16, 18]

steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: install
run: npm install --include=dev

- name: lint
run: npm run lint

- name: generate-docs
run: npm run docs

- name: pack
run: npm pack

- name: install-globally
run: npm i -g solhint*tgz

- name: run-e2e-tests
run: cd e2e && npm install && npm test
69 changes: 69 additions & 0 deletions .github/workflows/TESTS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: TESTS

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
test_on_linux:
name: Run linter and tests on Linux
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14, 16, 18]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint
- name: Run Tests
run: npm test

test_on_windows:
name: Run linter and tests on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint
- name: Run Tests
run: npm test

test_on_macos:
name: Run linter and tests on MacOS
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint
- name: Run Tests
run: npm test
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[![Donate with Ethereum](https://en.cryptobadges.io/badge/micro/0xe8cdf02efd8ab0a490d7b2cb13553389c9bc932e)](https://en.cryptobadges.io/donate/0xe8cdf02efd8ab0a490d7b2cb13553389c9bc932e)

[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/solhint/Lobby)
[![Build Status](https://travis-ci.org/protofire/solhint.svg?branch=master)](https://travis-ci.org/protofire/solhint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created an issue to track removing the other broken badges #413

[![NPM version](https://badge.fury.io/js/solhint.svg)](https://npmjs.org/package/solhint)
[![Coverage Status](https://coveralls.io/repos/github/protofire/solhint/badge.svg?branch=master)](
https://coveralls.io/github/protofire/solhint?branch=master)
Expand Down
3 changes: 2 additions & 1 deletion test/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const fs = require('fs')
const os = require('os')
const path = require('path')

function tmpFilePath() {
const tempDirPath = os.tmpdir()
return `${tempDirPath}/test.sol`
return path.resolve(tempDirPath, 'test.sol')
}

function storeAsFile(code) {
Expand Down
6 changes: 5 additions & 1 deletion test/rules/miscellaneous/quotes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const assert = require('assert')
const os = require('os')
const linter = require('../../../lib/index')
const { contractWith, funcWith } = require('../../common/contract-builder')
const { storeAsFile, removeTmpFiles } = require('../../common/utils')
Expand Down Expand Up @@ -77,7 +78,10 @@ describe('Linter - quotes', () => {
assert.equal(report.filePath, filePath)
})

it('should raise one error', () => {
it('should raise one error', function test() {
if (os.type() === 'Windows_NT') {
this.skip()
}
const filePath = storeAsFile(contractWith("string private a = 'test';"))

const reports = linter.processPath(filePath, {
Expand Down