Skip to content

Commit

Permalink
Combine tests into single workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Aug 16, 2023
1 parent 0afcdb3 commit 925faf0
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 6 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,80 @@ jobs:
- name: Run tests
run: |
npm run test:coverage
integration:
name: Integration testing with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: true
max-parallel: 1
matrix:
node-version:
- lts/*

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: |
npm ci
- name: Build
run: |
npm run build --if-present
- name: Run integration tests
env:
TUMBLR_OAUTH_CONSUMER_KEY: ${{ secrets.TUMBLR_OAUTH_CONSUMER_KEY }}
TUMBLR_OAUTH_CONSUMER_SECRET: ${{ secrets.TUMBLR_OAUTH_CONSUMER_SECRET }}
TUMBLR_OAUTH_TOKEN: ${{ secrets.TUMBLR_OAUTH_TOKEN }}
TUMBLR_OAUTH_TOKEN_SECRET: ${{ secrets.TUMBLR_OAUTH_TOKEN_SECRET }}
run: |
npm run test:integration
integration-write:
name: Integration testing with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
environment: integration-suite

strategy:
fail-fast: true
max-parallel: 1
matrix:
node-version:
- lts/*

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: |
npm ci
- name: Build
run: |
npm run build --if-present
- name: Run integration tests
env:
TUMBLR_OAUTH_CONSUMER_KEY: ${{ secrets.TUMBLR_OAUTH_CONSUMER_KEY }}
TUMBLR_OAUTH_CONSUMER_SECRET: ${{ secrets.TUMBLR_OAUTH_CONSUMER_SECRET }}
TUMBLR_OAUTH_TOKEN: ${{ secrets.TUMBLR_OAUTH_TOKEN }}
TUMBLR_OAUTH_TOKEN_SECRET: ${{ secrets.TUMBLR_OAUTH_TOKEN_SECRET }}
run: |
npm run test:integration-write
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- master

jobs:
tests:
integration-read-only:
name: Integration testing with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
environment: integration-suite
Expand Down
8 changes: 4 additions & 4 deletions integration/write.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ describe('oauth1 write requests', () => {
);
});

describe('photo post', () => {
it('creates a post via data', async () => {
describe('create photo post', () => {
it('via data', async () => {
const data = await readFile(new URL('../test/fixtures/image.jpg', import.meta.url));

const res = await client.createPost(blogName, {
Expand All @@ -72,7 +72,7 @@ describe('oauth1 write requests', () => {
assert.isOk(res);
});

it('creates a slideshow post via data[]', async () => {
it('via data[]', async () => {
const data = await readFile(new URL('../test/fixtures/image.jpg', import.meta.url));

const res = await client.createPost(blogName, {
Expand All @@ -85,7 +85,7 @@ describe('oauth1 write requests', () => {
assert.isOk(res);
});

it(`creates a post via data64`, async () => {
it('via data64', async () => {
const data = await readFile(new URL('../test/fixtures/image.jpg', import.meta.url), {
encoding: 'base64',
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"gh-pages": "git subtree push --prefix=gh-pages origin gh-pages",
"test": "mocha --timeout 100",
"test:coverage": "nyc npm run test",
"test:integration": "mocha ./integration",
"test:integration": "mocha ./integration/read-only",
"test:integration-write": "mocha ./integration/write",
"lint": "eslint --report-unused-disable-directives --ext 'js' --ext 'mjs' lib test integration"
},
"engines": {
Expand Down

0 comments on commit 925faf0

Please sign in to comment.