Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test workflow #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
node_modules/
.j1-integration/
dist/
.env
.eslintcache
.git/
.github/
configs/
docs/
terraform/
test/
CHANGELOG.md
husky.config.js
jest.config.js
lint-staged-config.js
prettier.config.js
.eslintignore
.eslintrc
.gitleaks.yml
.prettierignore
75 changes: 8 additions & 67 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,14 @@ name: Build
on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [14.x]
os: [ubuntu-latest]

steps:
- id: setup-node
name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Check out code repository source code
uses: actions/checkout@v2

- name: Install dependencies
run: yarn

- name: Run tests
run: yarn test:ci

- name: Run build
run: yarn build

# Publishing is done in a separate job to allow
# for all matrix builds to complete.
release:
needs: test
publish-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
strategy:
fail-fast: false
matrix:
node: [14]

steps:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Check out repo
uses: actions/checkout@v2
- uses: actions/checkout@v3
- id: publish-image
uses: jupiterone/[email protected]
with:
fetch-depth: 2

# Fetch tags and describe the commit before the merge commit
# to see if it's a version publish
- name: Fetch tags
run: |
git fetch --tags
if git describe --exact-match --match "v*.*.*" HEAD^2
then
echo "Found version commit tag. Publishing."
echo "publish=true" >> $GITHUB_ENV
else
echo "Version commit tag not found. Not publishing."
fi

- name: Publish
if: env.publish == 'true'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
yarn
npm publish
package-name: 'ceelias/graph-salesforce'
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
docker-password: ${{ secrets.DOCKERHUB_TOKEN }}
push-to-registry: 'true'
11 changes: 0 additions & 11 deletions .github/workflows/gitleaks.yml

This file was deleted.

18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:14-bullseye-slim

ARG j1_dev_enabled=false

ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration

RUN apt-get update
RUN apt-get -y install g++ make python

COPY package.json yarn.lock LICENSE ${JUPITERONE_INTEGRATION_DIR}/
COPY src/ ${JUPITERONE_INTEGRATION_DIR}/src
COPY scripts/ ${JUPITERONE_INTEGRATION_DIR}/scripts

WORKDIR ${JUPITERONE_INTEGRATION_DIR}
RUN yarn install
RUN chmod +x ./scripts/run.sh

CMD ["yarn", "execute"]
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"scripts": {
"start": "j1-integration collect",
"execute": "./scripts/run.sh",
"collect": "./scripts/collect.sh",
"graph": "j1-integration visualize",
"graph:types": "j1-integration visualize-types",
"lint": "eslint . --cache --fix --ext .ts,.tsx",
Expand Down
3 changes: 3 additions & 0 deletions scripts/collect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration collect
8 changes: 8 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

if [ -z "$JUPITERONE_API_BASE_URL" ]
then
JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration run -i $INTEGRATION_INSTANCE_ID
else
JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration run -i $INTEGRATION_INSTANCE_ID --api-base-url $JUPITERONE_API_BASE_URL
fi