Skip to content
Open
14 changes: 14 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
status:
project:
default:
enabled: true
target: 80%
threshold: null
base: auto
patch:
default:
enabled: true
target: 80%
threshold: null
base: auto
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

# Mirrors the CircleCI 'build' job so GitHub Actions runs the same pipeline: install
# dependencies, run the lint + unit tests with coverage, and upload coverage to Codecov.
# CircleCI is kept in parallel for now and will be removed once this fully replaces it.
on:
push:
branches:
- '**'

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: build
runs-on: ubuntu-latest
permissions:
contents: read
checks: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '12'
cache: npm

- name: Install
run: npm install

- name: Test
run: npm test

# On a test failure only, publish a "Tests" check with the failed tests, their error
# message and stack trace (reads the Mocha JUnit report). Green runs show nothing.
- name: Publish test results
if: failure()
uses: mikepenz/action-junit-report@v5
with:
check_name: Tests
report_paths: 'test/results/**/*.xml'
skip_success_summary: true
fail_on_failure: false

- name: Upload coverage to Codecov
if: success()
uses: codecov/codecov-action@v6
with:
files: coverage/lcov.info
fail_ci_if_error: false
8 changes: 5 additions & 3 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ name: AIO App CI
on:
release:
types: [released]

jobs:
deploy:
name: Deploy to Prod
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
node-version: ['12']
node-version: ['18']
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: npm install
run: npm i
- name: Setup CLI
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy_stage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: AIO App CI
name: Deploy to Stage

on:
push:
Expand All @@ -11,15 +11,16 @@ jobs:
strategy:
max-parallel: 1
matrix:
node-version: ['12']
node-version: ['18']
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: npm install
run: npm i
- name: Setup CLI
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
name: AIO App CI

on: [pull_request]

jobs:
test:
name: Test PR
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: ['12']
os: [macOS-latest, ubuntu-latest, windows-latest]
node-version: ['18']
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: npm install
run: npm i
# aio-cli 8.x bundles an old node-gyp that imports distutils, removed from
# Python 3.12+. Pin Python 3.11 so native deps (e.g. @parcel/watcher) build
# on runners that compile from source (macOS arm64).
- name: Use Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup CLI
uses: adobe/aio-cli-setup-action@1.1.0
with:
Expand Down
27 changes: 20 additions & 7 deletions actions/common/RemoteResolverFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,34 @@ const openwhisk = require('openwhisk');
const { print } = require('graphql');

/**
* This class implements a GraphQL Fetcher that can be used with the graphql-tools
* library to query a remote GraphQL endpoint deployed in an Adobe I/O Runtime action.
* This class implements a GraphQL Executor that can be used with the @graphql-tools/wrap
* library (introspectSchema/wrapSchema) to query a remote GraphQL endpoint deployed in an
* Adobe I/O Runtime action.
*/
class RemoteResolverFetcher {
constructor(actionName) {
this.actionName = actionName;

// We export a method which MUST be bound to the object
// because it's not going to be called with 'this.fetcher()'
this.fetcher = this.__fetch.bind(this);
// because it's not going to be called with 'this.executor()'
this.executor = this.__execute.bind(this);
}

__fetch(params) {
let query = print(params.query); // Convert from AST to String
__execute(params) {
let query = print(params.document); // Convert from AST to String
let context = params.context ? params.context.graphqlContext : null;

// Derive the operation name from the first named OperationDefinition in the document
let operationName = null;
if (params.document && Array.isArray(params.document.definitions)) {
let operationDefinition = params.document.definitions.find(
(definition) => definition.kind === 'OperationDefinition' && definition.name && definition.name.value
);
if (operationDefinition) {
operationName = operationDefinition.name.value;
}
}

let ow = openwhisk();
return ow.actions.invoke({
actionName: this.actionName,
Expand All @@ -41,7 +54,7 @@ class RemoteResolverFetcher {
params: {
query,
variables: params.variables,
operationName: params.operationName,
operationName,
context
}
});
Expand Down
Loading
Loading