Skip to content

Commit

Permalink
CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gschier committed Sep 9, 2024
1 parent b72e037 commit 48e62eb
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 203 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on: push

jobs:
ci:
runs-on: ubuntu-latest
name: CI
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- run: npm install

- run: npm test
working-directory: npm/cli-darwin-arm64
env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }

- name: Publish @yaakapp/cli-darwin-x64
run: npm publish --provenance --access public
working-directory: npm/cli-darwin-x64
env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }

- name: Publish @yaakapp/cli-linux-x64
run: npm publish --provenance --access public
working-directory: npm/cli-linux-x64
env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }

- name: Publish @yaakapp/cli-win32-x64
run: npm publish --provenance --access public
working-directory: npm/cli-win32-x64
env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }

- name: Publish @yaakapp/cli
run: npm publish --provenance --access public
working-directory: npm/cli
env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"repository": "https://github.com/yaakapp/plugins",
"private": true,
"scripts": {
"build": "node scripts/build-plugins.cjs"
"build": "node scripts/build-plugins.cjs",
"test": "vitest run"
},
"devDependencies": {
"jsonpath": "^1.1.1",
Expand Down
44 changes: 22 additions & 22 deletions plugins/exporter-curl/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { pluginHookExport } from '../src';
const ctx = {} as Context;

describe('exporter-curl', () => {
test('Exports GET with params', () => {
test('Exports GET with params', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
urlParameters: [
{ name: 'a', value: 'aaa' },
Expand All @@ -19,9 +19,9 @@ describe('exporter-curl', () => {
[`curl 'https://yaak.app'`, `--url-query 'a=aaa'`, `--url-query 'b=bbb'`].join(` \\\n `),
);
});
test('Exports POST with url form data', () => {
test('Exports POST with url form data', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
method: 'POST',
bodyType: 'application/x-www-form-urlencoded',
Expand All @@ -38,9 +38,9 @@ describe('exporter-curl', () => {
);
});

test('Exports PUT with multipart form', () => {
test('Exports PUT with multipart form', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
method: 'PUT',
bodyType: 'multipart/form-data',
Expand All @@ -63,9 +63,9 @@ describe('exporter-curl', () => {
);
});

test('Exports JSON body', () => {
test('Exports JSON body', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
method: 'POST',
bodyType: 'application/json',
Expand All @@ -83,9 +83,9 @@ describe('exporter-curl', () => {
);
});

test('Exports multi-line JSON body', () => {
test('Exports multi-line JSON body', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
method: 'POST',
bodyType: 'application/json',
Expand All @@ -103,9 +103,9 @@ describe('exporter-curl', () => {
);
});

test('Exports headers', () => {
test('Exports headers', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
headers: [
{ name: 'a', value: 'aaa' },
{ name: 'b', value: 'bbb', enabled: true },
Expand All @@ -115,9 +115,9 @@ describe('exporter-curl', () => {
).toEqual([`curl`, `--header 'a: aaa'`, `--header 'b: bbb'`].join(` \\\n `));
});

test('Basic auth', () => {
test('Basic auth', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
authenticationType: 'basic',
authentication: {
Expand All @@ -128,19 +128,19 @@ describe('exporter-curl', () => {
).toEqual([`curl 'https://yaak.app'`, `--user 'user:pass'`].join(` \\\n `));
});

test('Broken basic auth', () => {
test('Broken basic auth', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
authenticationType: 'basic',
authentication: {},
}),
).toEqual([`curl 'https://yaak.app'`, `--user ':'`].join(` \\\n `));
});

test('Digest auth', () => {
test('Digest auth', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
authenticationType: 'digest',
authentication: {
Expand All @@ -151,9 +151,9 @@ describe('exporter-curl', () => {
).toEqual([`curl 'https://yaak.app'`, `--digest --user 'user:pass'`].join(` \\\n `));
});

test('Bearer auth', () => {
test('Bearer auth', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
authenticationType: 'bearer',
authentication: {
Expand All @@ -163,9 +163,9 @@ describe('exporter-curl', () => {
).toEqual([`curl 'https://yaak.app'`, `--header 'Authorization: Bearer tok'`].join(` \\\n `));
});

test('Broken bearer auth', () => {
test('Broken bearer auth', async () => {
expect(
pluginHookExport(ctx, {
await pluginHookExport(ctx, {
url: 'https://yaak.app',
authenticationType: 'bearer',
authentication: {
Expand Down
6 changes: 3 additions & 3 deletions plugins/importer-curl/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Context, HttpRequest, Model, Workspace } from '@yaakapp/api';
import { describe, expect, test } from 'vitest';
import { HttpRequest, Model, Workspace } from '../../../src-web/lib/models';
import { pluginHookImport } from '../src';

const ctx = {};
const ctx = {} as Context;

describe('importer-curl', () => {
test('Imports basic GET', () => {
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('importer-curl', () => {
url: 'https://yaak.app',
urlParameters: [
{ name: 'foo', value: 'bar', enabled: true },
{ name: 'baz', value: 'a%20a', enabled: true },
{ name: 'baz', value: 'a a', enabled: true },
],
}),
],
Expand Down
177 changes: 0 additions & 177 deletions plugins/template-function-response/tests/index.test.ts

This file was deleted.

0 comments on commit 48e62eb

Please sign in to comment.