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

HPC-8681 Include CDM in hpc-api #116

Open
wants to merge 1 commit into
base: develop
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
1 change: 1 addition & 0 deletions external/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hpc_cdm
9 changes: 9 additions & 0 deletions external/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'Setup External Repos'
description: 'Clone repositories specified in manifest file'
author: 'Sam Lanning <[email protected]>'
runs:
using: 'node16'
main: 'setup.js'
branding:
icon: 'download-cloud'
color: 'purple'
7 changes: 7 additions & 0 deletions external/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"path": "hpc_cdm",
"url": "https://github.com/UN-OCHA/hpc-cdm.git",
"ref": "develop"
}
]
43 changes: 43 additions & 0 deletions external/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @ts-check

const child_process = require('child_process');
const path = require('path');
const {
promises: { stat },
} = require('fs');
const { promisify } = require('util');

const manifest = require('./manifest.json');

const exec = promisify(child_process.exec);

(async () => {
for (const entry of manifest) {
const p = path.resolve(__dirname, entry.path);
console.log(`Setting up external repo ${p}`);

const exists = await stat(p)
.then(() => true)
.catch(() => false);
if (!exists) {
// Clone repository
const clone = await exec(`git clone "${entry.url}" "${p}"`);
console.log(clone.stderr);
console.log(clone.stdout);
}

// Fetch desired commit
const fetch = await exec(`git fetch origin ${entry.ref}`, {
cwd: p,
});
console.log(fetch.stderr);
console.log(fetch.stdout);

// Fetch desired commit
const checkout = await exec(`git checkout ${entry.ref}`, {
cwd: p,
});
console.log(checkout.stderr);
console.log(checkout.stdout);
}
})();
16 changes: 13 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@
"esModuleInterop": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"strict": true
"strict": true,
"baseUrl": "external/hpc_cdm",
"paths": {
"@unocha/hpc-core": ["libs/hpc-core/src/"],
"@unocha/hpc-data": ["libs/hpc-data/src/"],
"@unocha/hpc-live/lib/model": ["libs/hpc-live/src/lib/model"]
}
},
"include": ["src/**/*.ts", "src/**/*.js", "start.js", "bin"],
"exclude": ["node_modules"]
"include": ["src/**/*.ts", "src/**/*.js", "start.js", "bin", "external"],
"exclude": [
"node_modules",
"external/hpc_cdm/node_modules",
"external/hpc_cdm/tmp"
]
}