Skip to content

Commit

Permalink
Merge pull request #6 from kmontag/gh-actions
Browse files Browse the repository at this point in the history
Switch from Travis to GitHub Actions
  • Loading branch information
kmontag authored Jul 9, 2022
2 parents 62a7a95 + a3e2e7b commit 698f818
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 20 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Build

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# We're ignoring `package-lock.json` since this is an NPM
# package, meaning `npm ci` (the usual installation command)
# isn't appropriate here.
- run: npm install
- run: npm run build --if-present
- run: npm test
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish NPM package

on:
push:
branches:
- master

jobs:
release:

name: Release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- run: npm install
- run: npm run build --if-present
- run: npm test
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 0 additions & 16 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
@@ -1,4 +1,3 @@
[![Build Status](https://travis-ci.org/kmontag/protobufjs-loader.svg?branch=master)](https://travis-ci.org/kmontag/protobufjs-loader)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

# protobufjs-loader
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Webpack loader to translate .proto definitions to ProtoBuf.js modules",
"main": "index.js",
"scripts": {
"test": "mocha test/*.test.js",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"test": "mocha test/*.test.js"
},
"keywords": [
"webpack",
Expand Down
23 changes: 22 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ const path = require('path');

const compile = require('./helpers/compile');

before(function(done) {
// The first time the compiler gets run (e.g. in a CI environment),
// some additional packages will be installed in the
// background. This can take awhile and trigger a timeout, so we do
// it here explicitly first.
this.timeout(10000);
compile('basic').then(function(inspect) {
done();
});
});

describe('with JSON / reflection', function() {
beforeEach(function() {
Expand Down Expand Up @@ -92,4 +102,15 @@ describe('with imports', function() {
done();
});
});
});

it('should fail when the import is not found', function(done) {
compile('import', {
json: true,
// No include paths provided, so the 'import' fixture should
// fail to compile.
}).catch((err) => {
// Nothing to assert, we're just testing that the error happened.
done();
});
});
});

0 comments on commit 698f818

Please sign in to comment.