Skip to content

Commit d9fa66b

Browse files
authored
chore(ci): setup windows/macos tests, coverage reports and add release workflow (#4)
1 parent 6201fde commit d9fa66b

File tree

12 files changed

+103
-31
lines changed

12 files changed

+103
-31
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ jobs:
66
lint:
77
name: Lint source
88
runs-on: ubuntu-latest
9-
strategy:
10-
fail-fast: false
119
steps:
1210
- name: Setup repo
1311
uses: actions/checkout@v2
1412

1513
- name: Setup Deno
1614
uses: denolib/setup-deno@v2
15+
with:
16+
deno-version: v1.x
1717

1818
- name: Check formatting
1919
run: deno fmt --check

.github/workflows/nightly.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
os: [ubuntu-latest]
14+
os: [ macOS-latest, windows-latest, ubuntu-latest ]
1515
deno_version: [ nightly ]
1616
steps:
1717
- name: Setup repo
@@ -23,11 +23,12 @@ jobs:
2323
deno-version: ${{ matrix.deno_version }}
2424

2525
- name: Setup FFmpeg
26-
run: >
27-
sudo add-apt-repository ppa:jonathonf/ffmpeg-4 &&
28-
sudo apt update &&
29-
sudo apt install ffmpeg &&
30-
ffmpeg -version
26+
uses: FedericoCarboni/setup-ffmpeg@v1
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Check FFmpeg
31+
run: ffmpeg -version && ffprobe -version
3132

3233
- name: Check formatting
3334
run: deno fmt --check

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup repo
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Deno
17+
uses: denolib/setup-deno@v2
18+
with:
19+
deno-version: v1.x
20+
21+
- name: Setup eggs
22+
run: >
23+
deno install --unstable --allow-all https://x.nest.land/[email protected]/eggs.ts &&
24+
eggs link "${NEST_TOKEN}"
25+
env:
26+
NEST_TOKEN: ${{ secrets.NEST_TOKEN }}
27+
28+
- name: Publish Nest.land
29+
run: eggs publish --no-check --yes

.github/workflows/test.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,45 @@ on:
88

99
jobs:
1010
test:
11-
name: Test source
11+
name: Deno Stable
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ubuntu-latest]
17-
deno_version: [ v1.2.0, v1.x ]
16+
os: [ macOS-latest, windows-latest, ubuntu-latest ]
17+
deno: [ v1.6.2, v1.x ]
1818
steps:
1919
- name: Setup repo
2020
uses: actions/checkout@v2
2121

2222
- name: Setup Deno
2323
uses: denolib/setup-deno@v2
2424
with:
25-
deno-version: ${{ matrix.deno_version }}
25+
deno-version: ${{ matrix.deno }}
2626

2727
- name: Setup FFmpeg
28-
run: >
29-
sudo add-apt-repository ppa:jonathonf/ffmpeg-4 &&
30-
sudo apt update &&
31-
sudo apt install ffmpeg &&
32-
ffmpeg -version
28+
uses: FedericoCarboni/setup-ffmpeg@v1
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Check FFmpeg
33+
run: ffmpeg -version && ffprobe -version
3334

3435
- name: Run tests
36+
if: ${{ matrix.deno != 'v1.x' }}
3537
run: deno test --allow-read --allow-run --allow-write
38+
39+
- name: Run tests
40+
if: ${{ matrix.deno == 'v1.x' }}
41+
run: deno test --unstable --allow-read --allow-run --allow-write --coverage=./cov
42+
43+
- name: Generate lcov
44+
if: ${{ matrix.deno == 'v1.x' }}
45+
run: deno coverage --unstable --lcov ./cov > cov.lcov
46+
47+
- name: Upload coverage
48+
if: ${{ matrix.deno == 'v1.x' }}
49+
uses: codecov/codecov-action@v1
50+
with:
51+
name: ${{ matrix.os }}-${{ matrix.deno }}
52+
files: cov.lcov

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<img alt="Version" src="https://img.shields.io/github/v/release/c4spar/deno-fast-forward?logo=github&color=blue&label=latest" />
1111
</a>
1212
<a href="https://deno.land/">
13-
<img alt="Deno version" src="https://img.shields.io/badge/deno-^1.2.0-blue?logo=deno" />
13+
<img alt="Deno version" src="https://img.shields.io/badge/deno-^1.6.2-blue?logo=deno" />
1414
</a>
1515
<a href="https://doc.deno.land/https/deno.land/x/fast_forward/mod.ts">
1616
<img alt="doc" src="https://img.shields.io/badge/deno-doc-yellow?logo=deno" />

dev_deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export { exists } from "https://deno.land/[email protected]/fs/exists.ts";
1010

1111
export { ensureDir } from "https://deno.land/[email protected]/fs/ensure_dir.ts";
1212

13-
export { dirname } from "https://deno.land/[email protected]/path/mod.ts";
13+
export { dirname, fromFileUrl } from "https://deno.land/[email protected]/path/mod.ts";
1414

1515
export {
1616
MuxAsyncIterator,

encoding_event_stream_test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { assertInstanceOf } from "./_assertions.ts";
2-
import { assertEquals, dirname, ensureDir, exists } from "./dev_deps.ts";
2+
import {
3+
assertEquals,
4+
dirname,
5+
ensureDir,
6+
exists,
7+
fromFileUrl,
8+
} from "./dev_deps.ts";
39
import { Encoding } from "./encoding.ts";
410
import { EncodingProcess } from "./encoding_process.ts";
511
import { EncodingEventStream } from "./encoding_event_stream.ts";
@@ -12,7 +18,7 @@ import {
1218
import { EncodingProgressEvent } from "./events.ts";
1319
import { FFmpeg } from "./ffmpeg.ts";
1420

15-
const rootDir: string = dirname(import.meta.url).replace(/^file:\/\//, "");
21+
const rootDir: string = dirname(fromFileUrl(import.meta.url));
1622
const inputPath = `${rootDir}/fixtures/sample.mp4`;
1723

1824
Deno.test({

encoding_process_test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import { assertEquals, dirname, ensureDir, exists } from "./dev_deps.ts";
1+
import {
2+
assertEquals,
3+
dirname,
4+
ensureDir,
5+
exists,
6+
fromFileUrl,
7+
} from "./dev_deps.ts";
28
import { Encoding } from "./encoding.ts";
39
import { EncodingProcess } from "./encoding_process.ts";
410

5-
const rootDir: string = dirname(import.meta.url).replace(/^file:\/\//, "");
11+
const rootDir: string = dirname(fromFileUrl(import.meta.url));
612
const inputPath = `${rootDir}/fixtures/sample.mp4`;
713

814
Deno.test({

encoding_test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import { assertEquals, dirname, ensureDir, exists } from "./dev_deps.ts";
1+
import {
2+
assertEquals,
3+
dirname,
4+
ensureDir,
5+
exists,
6+
fromFileUrl,
7+
} from "./dev_deps.ts";
28
import { Encoding } from "./encoding.ts";
39
import { EncodingProcess } from "./encoding_process.ts";
410

5-
const rootDir: string = dirname(import.meta.url).replace(/^file:\/\//, "");
11+
const rootDir: string = dirname(fromFileUrl(import.meta.url));
612
const inputPath = `${rootDir}/fixtures/sample.mp4`;
713

814
Deno.test({

errors_test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { assertExpectError, assertInstanceOf } from "./_assertions.ts";
2-
import { assertThrows, assertThrowsAsync, dirname } from "./dev_deps.ts";
2+
import {
3+
assertThrows,
4+
assertThrowsAsync,
5+
dirname,
6+
fromFileUrl,
7+
} from "./dev_deps.ts";
38
import { Encoding } from "./encoding.ts";
49
import { EncodingEventStream } from "./encoding_event_stream.ts";
510
import { EncodingProcess } from "./encoding_process.ts";
@@ -18,7 +23,7 @@ import { EncodingErrorEvent } from "./events.ts";
1823
import { ffmpeg } from "./ffmpeg.ts";
1924
import { ffprobe } from "./ffprobe.ts";
2025

21-
const rootDir: string = dirname(import.meta.url).replace(/^file:\/\//, "");
26+
const rootDir: string = dirname(fromFileUrl(import.meta.url));
2227
const inputPath = `${rootDir}/fixtures/sample.mp4`;
2328

2429
Deno.test({
@@ -35,7 +40,7 @@ Deno.test({
3540
name: "ffprobe binary permission denied error",
3641
async fn() {
3742
await assertThrowsAsync(
38-
() => ffprobe(inputPath, { binary: new URL(import.meta.url).pathname }),
43+
() => ffprobe(inputPath, { binary: rootDir }),
3944
FFprobeBinaryPermissionDenied,
4045
);
4146
},
@@ -65,7 +70,7 @@ Deno.test({
6570
name: "ffmpeg binary permission denied error",
6671
fn() {
6772
const encoding = new Encoding();
68-
encoding.binary = new URL(import.meta.url).pathname;
73+
encoding.binary = rootDir;
6974
const process = new EncodingProcess(encoding);
7075
assertThrows(() => process.run(), FFmpegBinaryPermissionDenied);
7176
},

0 commit comments

Comments
 (0)