Skip to content

Commit

Permalink
GitHub Actions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
boonya authored Feb 4, 2021
1 parent cbdbea6 commit 6e7205f
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 5 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: release

on:
release:
types: [published]

env:
NODE: '12.20.1'
METEOR: '2.0'

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- name: Checking repo out
uses: actions/checkout@v1
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE }}
- name: Install dependencies
run: npm ci
- name: Linting
run: npm run lint

test:
runs-on: ubuntu-20.04
steps:
- name: Checking repo out
uses: actions/checkout@v1
- name: Setup Meteor
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: ${{ env.METEOR }}
- name: Install dependencies
run: meteor npm install
- name: Run tests
run: npm run test

deploy:
runs-on: ubuntu-20.04
needs: [lint, test]
steps:
- name: Checking repo out
uses: actions/checkout@v1

- name: Setup Meteor
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: ${{ env.METEOR }}

- name: Install dependencies
run: meteor npm install

- name: Build application
run: npm run build

- name: Collect data
id: data
run: |
TAG=$(echo ${{ github.ref }} | cut -d'/' -f 3)
echo ::set-output name=TAG::${TAG}
echo ::set-output name=REPO::${{ github.repository }}
echo ::set-output name=SRC::${{ github.event.repository.name }}.tar.gz
echo ::set-output name=DST::recorder.tar.gz
shell: bash

- name: Upload application bundle to the artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.data.outputs.dst }}
path: ${{ steps.data.outputs.src }}

- name: Retrieve UPLOAD_URL
id: release
run: |
upload_url=$(curl -sL https://api.github.com/repos/${{ steps.data.outputs.repo }}/releases/tags/${{ steps.data.outputs.tag }} | jq -r '.upload_url')
echo ::set-output name=UPLOAD_URL::$upload_url
shell: bash

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ${{ steps.data.outputs.src }}
asset_name: ${{ steps.data.outputs.dst }}
asset_content_type: application/gzip
35 changes: 35 additions & 0 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: verification

on:
push:
paths-ignore:
- '**.md'
- 'LICENCE'
pull_request:
paths-ignore:
- '**.md'
- 'LICENCE'

env:
NODE: '12.20.1'
METEOR: '2.0'

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE }}
- run: npm ci
- run: npm run lint
test-meteor:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: meteorengineer/setup-meteor@v1
with:
meteor-release: ${{ env.METEOR }}
- run: meteor npm install
- run: npm run test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Video Recorder application that captures IP Web Cams RTSP streams

![verification](https://github.com/boonya/meteor-ip-cam-recorder/workflows/verification/badge.svg)
![release](https://github.com/boonya/meteor-ip-cam-recorder/workflows/release/badge.svg)

## Run application in dev mode

```sh
Expand Down
2 changes: 1 addition & 1 deletion imports/api/recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {EventEmitter} from 'events';
import RtspRecorder, {RecorderEvents} from 'rtsp-video-recorder';

const log = (event) => (...args) => {
logInfo(`Event "${event}" \nat ${new Date().toString()}:`)(...args);
logInfo('Recorder Event', event, 'at', new Date().toString())(...args);
};

export const Events = {
Expand Down
2 changes: 1 addition & 1 deletion imports/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const RECORDER = {

export const ENV = {
LOGGING: LOGGING === 'true',
}
};
2 changes: 1 addition & 1 deletion imports/ui/Discover/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Item.propTypes = {
hostname: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
port: PropTypes.string.isRequired,
uri: PropTypes.object.isRequired,
uri: PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)).isRequired,
};

Item.defaultProps = {
Expand Down
1 change: 1 addition & 0 deletions imports/ui/List/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function Item({_id, title, state}) {
}, [_id]);

const handleRemove = React.useCallback(() => {
// eslint-disable-next-line no-alert
if (confirm('Do you really want to remove a camera?')) {
// eslint-disable-next-line promise/prefer-await-to-callbacks
Meteor.call(METHODS.CAMERA_REMOVE, _id, (err) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'assert';

describe('video-recorder', () => {
describe('meteor-ip-cam-recorder', () => {
it('package.json has correct name', async () => {
const {name} = await import(/* webpackChunkName: "package.json" */ '../package.json');
assert.strictEqual(name, 'video-recorder');
assert.strictEqual(name, 'meteor-ip-cam-recorder');
});

if (Meteor.isClient) {
Expand Down

0 comments on commit 6e7205f

Please sign in to comment.