Skip to content

Commit

Permalink
Merge pull request #3 from rudderlabs/test-action
Browse files Browse the repository at this point in the history
test only
  • Loading branch information
sivashanmukh authored Apr 29, 2021
2 parents bdc972c + f5d7b84 commit a8c3604
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
jobs:
request:
runs-on: ubuntu-latest
env:
TEST_ONLY: ${{ github.event_name != 'push' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16314,6 +16314,8 @@ const serverList = {
const transformationNameToId = {};
const libraryNameToId = {};

const testOnly = (process.env.TEST_ONLY == 'true');

function getTransformationsAndLibrariesFromLocal(transformations, libraries) {
core.info("metaFilePath test: " + metaFilePath);
let meta = JSON.parse(fs.readFileSync(metaFilePath, "utf-8"));
Expand All @@ -16323,8 +16325,6 @@ function getTransformationsAndLibrariesFromLocal(transformations, libraries) {
if (meta.libraries) {
libraries.push(...meta.libraries);
}
core.info(`transformations from meta: ${JSON.stringify(transformations)}`);
core.info(`libraries from meta: ${JSON.stringify(libraries)}`);
}

function buildNametoIdMap(objectArr, type) {
Expand Down Expand Up @@ -16521,8 +16521,11 @@ async function testAndPublish() {
core.info("Test Passed!!!");

// publish
res = await publish(transformationTest, librariesTest);
core.info(`Publish result: ${JSON.stringify(res.data)}`);
if (!testOnly) {
res = await publish(transformationTest, librariesTest);
core.info(`Publish result: ${JSON.stringify(res.data)}`);
}

} catch (err) {
if (err.response) {
core.error(err.response.data);
Expand Down
11 changes: 7 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const serverList = {
const transformationNameToId = {};
const libraryNameToId = {};

const testOnly = (process.env.TEST_ONLY == 'true');

function getTransformationsAndLibrariesFromLocal(transformations, libraries) {
core.info("metaFilePath test: " + metaFilePath);
let meta = JSON.parse(fs.readFileSync(metaFilePath, "utf-8"));
Expand All @@ -37,8 +39,6 @@ function getTransformationsAndLibrariesFromLocal(transformations, libraries) {
if (meta.libraries) {
libraries.push(...meta.libraries);
}
core.info(`transformations from meta: ${JSON.stringify(transformations)}`);
core.info(`libraries from meta: ${JSON.stringify(libraries)}`);
}

function buildNametoIdMap(objectArr, type) {
Expand Down Expand Up @@ -235,8 +235,11 @@ async function testAndPublish() {
core.info("Test Passed!!!");

// publish
res = await publish(transformationTest, librariesTest);
core.info(`Publish result: ${JSON.stringify(res.data)}`);
if (!testOnly) {
res = await publish(transformationTest, librariesTest);
core.info(`Publish result: ${JSON.stringify(res.data)}`);
}

} catch (err) {
if (err.response) {
core.error(err.response.data);
Expand Down

0 comments on commit a8c3604

Please sign in to comment.