Skip to content

Commit 30fad72

Browse files
authored
Merge pull request #4 from blinemedical/VIDEO-1921-setup-gstreamer
[VIDEO-1921] Setup GStreamer action
2 parents a724cd4 + f2c8a28 commit 30fad72

14 files changed

+7611
-398
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Description
2+
3+
[//]: # (Add a brief, one or two line description of the changes below)
4+
5+
6+
**Ticket(s) Addressed:**
7+
8+
[//]: # (Add all tickets addressed or related to this PR with links to JIRA)
9+
* VIDEO-XXXX
10+
11+
## Design Summary
12+
13+
[//]: # (Add a brief summary of the design of the changes as appropriate below, add a link to confluence if applicable)
14+
15+
16+
**Configuration changes:**
17+
18+
[//]: # (Define any changes to the settings or other flags, be sure to update the wiki page)
19+
20+
21+
## Testing Notes and Procedure
22+
23+
[//]: # (Add a description and steps for testing the changes)
24+
25+
26+
## Related Pull Requests
27+
28+
[//]: # (Add links to all related pull requests if applicable, edit this comment to add links when other requests are opened)
29+
* blinemedical/project#xxx

.github/workflows/check-dist.yml

+51-51
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
# `dist/index.js` is a special file in Actions.
2-
# When you reference an action with `uses:` in a workflow,
3-
# `index.js` is the code that will run.
4-
# For our project, we generate this file through a build process from other source files.
5-
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
6-
name: Check dist/
7-
8-
on:
9-
push:
10-
branches:
11-
- main
12-
paths-ignore:
13-
- '**.md'
14-
pull_request:
15-
paths-ignore:
16-
- '**.md'
17-
workflow_dispatch:
18-
19-
jobs:
20-
check-dist:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v2
25-
26-
- name: Set Node.js 12.x
27-
uses: actions/setup-node@v2.5.1
28-
with:
29-
node-version: 12.x
30-
31-
- name: Install dependencies
32-
run: npm ci
33-
34-
- name: Rebuild the dist/ directory
35-
run: npm run prepare
36-
37-
- name: Compare the expected and actual dist/ directories
38-
run: |
39-
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
40-
echo "Detected uncommitted changes after build. See status below:"
41-
git diff
42-
exit 1
43-
fi
44-
id: diff
45-
46-
# If index.js was different than expected, upload the expected version as an artifact
47-
- uses: actions/upload-artifact@v2
48-
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
49-
with:
50-
name: dist
51-
path: dist/
1+
# `dist/index.js` is a special file in Actions.
2+
# When you reference an action with `uses:` in a workflow,
3+
# `index.js` is the code that will run.
4+
# For our project, we generate this file through a build process from other source files.
5+
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
6+
name: Check dist/
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**.md'
14+
pull_request:
15+
paths-ignore:
16+
- '**.md'
17+
workflow_dispatch:
18+
19+
jobs:
20+
check-dist:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Set Node.js 12.x
27+
uses: actions/setup-node@v2.5.1
28+
with:
29+
node-version: 12.x
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Rebuild the dist/ directory
35+
run: npm run prepare
36+
37+
- name: Compare the expected and actual dist/ directories
38+
run: |
39+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
40+
echo "Detected uncommitted changes after build. See status below:"
41+
git diff
42+
exit 1
43+
fi
44+
id: diff
45+
46+
# If index.js was different than expected, upload the expected version as an artifact
47+
- uses: actions/upload-artifact@v2
48+
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
49+
with:
50+
name: dist
51+
path: dist/

.github/workflows/test.yml

+62-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,62 @@
1-
name: "units-test"
2-
on:
3-
pull_request:
4-
push:
5-
branches:
6-
- main
7-
- 'releases/*'
8-
9-
jobs:
10-
# unit tests
11-
units:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
- run: npm ci
16-
- run: npm test
17-
18-
# test action works running from the graph
19-
test:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v2
23-
- uses: ./
24-
with:
25-
milliseconds: 1000
1+
name: "units-test"
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
# unit tests
10+
units:
11+
runs-on: ${{ matrix.os }}-latest
12+
strategy:
13+
matrix:
14+
os: ['windows', 'macos']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- run: npm ci
18+
- run: npm test
19+
20+
# test action works running from the graph
21+
test:
22+
runs-on: ${{ matrix.os }}-latest
23+
strategy:
24+
matrix:
25+
os: ['windows', 'macos']
26+
arch: ['x86', 'x86_64']
27+
exclude:
28+
- os: 'macos'
29+
arch: 'x86'
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
- name: Setup GStreamer with default version
35+
id: setup_gstreamer_default
36+
uses: ./
37+
with:
38+
arch: ${{ matrix.arch }}
39+
40+
- name: Echo output path to env
41+
if: ${{ matrix.os == 'windows' }}
42+
run: |
43+
chcp 65001 #set code page to utf-8
44+
echo ("GSTREAMER_PATH=${{ steps.setup_gstreamer_default.outputs.gstreamerPath }}") >> $env:GITHUB_ENV
45+
46+
- name: Echo output path to env
47+
if: ${{ matrix.os == 'macos' }}
48+
run: |
49+
echo "GSTREAMER_PATH=${{ steps.setup_gstreamer_default.outputs.gstreamerPath }}" >> $GITHUB_ENV
50+
51+
- name: Run gst-inspect --version
52+
if: ${{ matrix.os == 'windows' }}
53+
run: |
54+
echo $env:GSTREAMER_PATH
55+
${{ env.GSTREAMER_PATH }}\bin\gst-inspect-1.0.exe --version
56+
57+
- name: Run gst-inspect --version
58+
if: ${{ matrix.os == 'macos' }}
59+
run: |
60+
echo $GSTREAMER_PATH
61+
$GSTREAMER_PATH/Commands/gst-inspect-1.0 --version
62+

CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @actions/actions-runtime
1+
* @blinemedical/video @blinemedical/cloud-video-qa

README.md

+52-116
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,52 @@
1-
# Create a JavaScript Action
2-
3-
<p align="center">
4-
<a href="https://github.com/actions/javascript-action/actions"><img alt="javscript-action status" src="https://github.com/actions/javascript-action/workflows/units-test/badge.svg"></a>
5-
</p>
6-
7-
Use this template to bootstrap the creation of a JavaScript action.:rocket:
8-
9-
This template includes tests, linting, a validation workflow, publishing, and versioning guidance.
10-
11-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
12-
13-
## Create an action from this template
14-
15-
Click the `Use this Template` and provide the new repo details for your action
16-
17-
## Code in Main
18-
19-
Install the dependencies
20-
21-
```bash
22-
npm install
23-
```
24-
25-
Run the tests :heavy_check_mark:
26-
27-
```bash
28-
$ npm test
29-
30-
PASS ./index.test.js
31-
✓ throws invalid number (3ms)
32-
wait 500 ms (504ms)
33-
test runs (95ms)
34-
...
35-
```
36-
37-
## Change action.yml
38-
39-
The action.yml defines the inputs and output for your action.
40-
41-
Update the action.yml with your name, description, inputs and outputs for your action.
42-
43-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
44-
45-
## Change the Code
46-
47-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
48-
49-
```javascript
50-
const core = require('@actions/core');
51-
...
52-
53-
async function run() {
54-
try {
55-
...
56-
}
57-
catch (error) {
58-
core.setFailed(error.message);
59-
}
60-
}
61-
62-
run()
63-
```
64-
65-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
66-
67-
## Package for distribution
68-
69-
GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.
70-
71-
Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.
72-
73-
Run prepare
74-
75-
```bash
76-
npm run prepare
77-
```
78-
79-
Since the packaged index.js is run from the dist folder.
80-
81-
```bash
82-
git add dist
83-
```
84-
85-
## Create a release branch
86-
87-
Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.
88-
89-
Checkin to the v1 release branch
90-
91-
```bash
92-
git checkout -b v1
93-
git commit -a -m "v1 release"
94-
```
95-
96-
```bash
97-
git push origin v1
98-
```
99-
100-
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
101-
102-
Your action is now published! :rocket:
103-
104-
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
105-
106-
## Usage
107-
108-
You can now consume the action by referencing the v1 branch
109-
110-
```yaml
111-
uses: actions/javascript-action@v1
112-
with:
113-
milliseconds: 1000
114-
```
115-
116-
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
1+
# Install GStreamer GitHub Action
2+
3+
This action installs GStreamer by leveraging the release binaries for a specific version found here:
4+
5+
```
6+
https://gstreamer.freedesktop.org/data/pkg/
7+
```
8+
9+
Supported runner environments are Windows and macOS.
10+
11+
## Inputs
12+
13+
### `version`
14+
15+
The version of GStreamer to install. The default is 1.18.4.
16+
17+
### `arch`
18+
19+
The architecture (`x86` or `x86_64`) of binaries to install.
20+
21+
## Outputs
22+
23+
### `gstreamerPath`
24+
25+
The installation path.
26+
27+
## Example Usage
28+
29+
In this example, it is a Windows environment and we want to set the `GSTREAMER_...` environment variables in a follow-on step. The first step runs the installation. The second step echoes the output variables from the previous step into variables that are then redirected into the `GITHUB_ENV` variable. If a next job were specified, it would have those variables set.
30+
31+
32+
```
33+
- name: Setup GStreamer
34+
id: setup_gstreamer
35+
uses: blinemedical/setup-gstreamer@1.0
36+
with:
37+
version: '1.19.90'
38+
arch: 'x86'
39+
- run: |
40+
chcp 65001 #set code page to utf-8
41+
echo ("GSTREAMER_1_0_ROOT_MSVC_X86=${{ steps.setup_gstreamer.outputs.gstreamerPath }}") >> $env:GITHUB_ENV
42+
- run: |
43+
echo $env:GSTREAMER_1_0_ROOT_MSVC_X86
44+
```
45+
46+
See the `.github/workflows/test.yml` for other examples.
47+
48+
-------------
49+
**References:**
50+
* [Custom Actions](https://docs.github.com/en/actions/creating-actions/about-custom-actions)
51+
* [Action Toolkit](https://github.com/actions/toolkit)
52+

0 commit comments

Comments
 (0)