Skip to content

Commit 8502d11

Browse files
jacobluryeroshni-b
andauthored
Add .github/workflows/ci.yml as a replacement for .travis.yml (CIMAC-CIDC#327)
* Add .github/workflows/ci.yml as a replacement for .travis.yml * Add missing link to nvm installation guide * Remove invalid environment variable usage * Replace double-quotes with single quotes * Appease the linter * Fix 'Report test coverage' step * Update .github/workflows/ci.yml Co-authored-by: Roshni <rbiswas@ds.dfci.harvard.edu> Co-authored-by: Roshni <rbiswas@ds.dfci.harvard.edu>
1 parent 316fef3 commit 8502d11

File tree

5 files changed

+111
-7
lines changed

5 files changed

+111
-7
lines changed

.github/workflows/ci.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
on:
2+
push:
3+
branches: [master, production]
4+
pull_request:
5+
branches: [master, production]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Node.js 14
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 14.x
16+
- name: Install dependencies
17+
run: |
18+
npm install
19+
- name: Setup codeclimate test coverage reporter
20+
run: |
21+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22+
chmod +x ./cc-test-reporter
23+
./cc-test-reporter before-build
24+
- name: Run linter
25+
run: |
26+
npm run lint
27+
- name: Run tests
28+
run: |
29+
npm run test -- --coverage
30+
- name: Report test coverage
31+
env:
32+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
33+
run: |
34+
./cc-test-reporter after-build --exit-code 0
35+
36+
build:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Set up Node.js ${{ env.NODE_VERSION }}
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: ${{ env.NODE_VERSION }}
44+
- name: Install dependencies
45+
run: |
46+
npm install
47+
- name: Create an optimized build
48+
env:
49+
IS_PROD: ${{ github.ref == 'refs/heads/production' }}
50+
run: |
51+
if $IS_PROD; then cat .env.prod > .env; else cat .env.staging > .env; fi
52+
npm run build
53+
- name: Archive the build artifacts
54+
uses: actions/upload-artifact@v2
55+
if: ${{ github.ref == 'refs/heads/production' || github.ref == 'refs/heads/staging' }}
56+
with:
57+
name: build-artifacts
58+
path: build
59+
60+
gcs-deploy:
61+
needs: [test, build]
62+
runs-on: ubuntu-latest
63+
if: ${{ github.ref == 'refs/heads/production' || github.ref == 'refs/heads/staging' }}
64+
steps:
65+
- uses: actions/checkout@v2
66+
- name: Download build artifacts
67+
uses: actions/download-artifact@v2
68+
with:
69+
name: build-artifacts
70+
path: build
71+
- name: Set up Cloud SDK
72+
uses: google-github-actions/setup-gcloud@master
73+
with:
74+
project_id: ${{ github.ref == 'refs/heads/production' && 'cidc-dfci' || 'cidc-dfci-staging' }}
75+
service_account_key: ${{ github.ref == 'refs/heads/production' && secrets.GCP_SA_KEY_PROD || secrets.GCP_SA_KEY_STAGING }}
76+
export_default_credentials: true
77+
- name: Deploy build artifacts to Cloud Storage
78+
env:
79+
BUCKET: ${{ github.ref == 'refs/heads/production' && 'gs://cidc-ui-prod' || 'gs://cidc-ui-staging'}}
80+
run: |
81+
# Copy the contents of the build directory to the GCS UI bucket
82+
gsutil -m -h 'Cache-Control:no-cache,max-age=0' cp -r build/* $BUCKET
83+
# Make all objects in the GCS UI bucket public
84+
gsutil iam ch allUsers:objectViewer $BUCKET

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

.prettierrc

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"tabWidth": 4
2+
"tabWidth": 4,
3+
"overrides": [
4+
{
5+
"files": "*.yml",
6+
"options": {
7+
"tabWidth": 2
8+
}
9+
}
10+
]
311
}

README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
| production | [production](https://github.com/CIMAC-CIDC/cidc-ui/tree/production) | [![Build Status](https://travis-ci.org/CIMAC-CIDC/cidc-ui.svg?branch=production)](https://travis-ci.org/CIMAC-CIDC/cidc-ui) || |
44
| staging | [master](https://github.com/CIMAC-CIDC/cidc-ui) | [![Build Status](https://travis-ci.org/CIMAC-CIDC/cidc-ui.svg?branch=master)](https://travis-ci.org/CIMAC-CIDC/cidc-ui) | [![Maintainability](https://api.codeclimate.com/v1/badges/5b511fb97b4e48906501/maintainability)](https://codeclimate.com/github/CIMAC-CIDC/cidc-ui/maintainability) | [![Test Coverage](https://api.codeclimate.com/v1/badges/5b511fb97b4e48906501/test_coverage)](https://codeclimate.com/github/CIMAC-CIDC/cidc-ui/test_coverage) |
55

6-
## CIDC UI Readme
6+
## CIDC UI
77

88
### Installation:
99

10-
Clone the project, and run `npm install`
10+
This repo uses [nvm](https://github.com/nvm-sh/nvm#install--update-script) for node version management. Configure your node version:
11+
```
12+
nvm use
13+
```
14+
Next, install the dependencies:
15+
```
16+
npm install
17+
```
1118

1219
### Build:
1320

src/components/browse-data/shared/BatchDownloadDialog.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,19 @@ const BatchDownloadDialog: React.FC<IBatchDownloadDialogProps> = ({
3434
<DialogContent>
3535
<CIDCMarkdown
3636
source={[
37-
`Download the "filelist.tsv" file for this file batch, and run this command in the desired download directory:`,
37+
'Download the "filelist.tsv" file for this file batch,' +
38+
"and run this command in the desired download directory:",
3839
"```bash",
3940
"cat filelist.tsv | xargs -n 2 -P 8 gsutil cp",
4041
"```",
41-
"If you haven't logged in with `gcloud` recently, you'll need to run `gcloud auth login` first.",
42+
"If you haven't logged in with `gcloud` recently, you'll " +
43+
"need to run `gcloud auth login` first.",
4244
"",
43-
"This command requires a [`gsutil`](https://cloud.google.com/storage/docs/gsutil_install) installation and a shell that supports `cat` and `xargs`.",
45+
"This command requires a [`gsutil`](https://cloud.google.com/storage/docs/gsutil_install) " +
46+
"installation and a shell that supports `cat` and `xargs`.",
4447
"",
45-
"Note: Batch downloads are resumable. If you cancel an ongoing download (e.g., using control+c), you can resume that download by rerunning the download command."
48+
"Note: Batch downloads are resumable. If you cancel an ongoing download (e.g., " +
49+
"using control+c), you can resume that download by rerunning the download command."
4650
].join("\n")}
4751
/>
4852
</DialogContent>

0 commit comments

Comments
 (0)