Skip to content

Commit

Permalink
Release v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanpizzillo committed Apr 13, 2021
2 parents c3404d5 + 4098edd commit 0dd12c4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 93 deletions.
108 changes: 20 additions & 88 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Workflow
on: [push, pull_request]
on: [ push, pull_request ]
jobs:
build:
name: Build, Test and Upload Artifacts
Expand Down Expand Up @@ -131,91 +131,23 @@ jobs:
pushd build-artifact
zip -r ../${BUILD_NAME}.zip *
popd
## Hack for forcing python3 because using the python shell
## by default uses 2.7
- name: Force using python3 for shell
shell: bash
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
## Install the Akamai netstorage module
- name: install python modules
shell: bash
run: |
## Update Setup Tools so that Edgegrid can install
python -m pip install --upgrade pip setuptools wheel
pip install -Iv netstorageapi==1.2.12
pip install requests edgegrid-python
## Actually do the upload
- name: Upload artifact to netstorage
shell: python
env:
NS_HOSTNAME: ${{ secrets.ns_hostname }}
NS_KEYNAME: ${{ secrets.ns_keyname }}
NS_KEY: ${{ secrets.ns_key }}
NS_CPCODE: ${{ secrets.ns_cpcode }}
PROP_CPCODE: ${{ secrets.prop_cpcode }}
EG_HOSTNAME: ${{ secrets.eg_hostname }}
EG_CLIENT_TOKEN: ${{ secrets.eg_client_token }}
EG_CLIENT_SECRET: ${{ secrets.eg_client_secret }}
EG_ACCESS_TOKEN: ${{ secrets.eg_access_token }}
ARTIFACT_FILENAME: ${{ format('{0}.zip', steps.set_vars.outputs.build_name) }}
run: |
import os
import requests
from akamai.netstorage import Netstorage, NetstorageError
from akamai.edgegrid import EdgeGridAuth
from urllib.parse import urljoin
NS_HOSTNAME = os.environ.get('NS_HOSTNAME')
NS_KEYNAME = os.environ.get('NS_KEYNAME')
NS_KEY = os.environ.get('NS_KEY')
NS_CPCODE = os.environ.get('NS_CPCODE')
REPO_NAME = os.environ.get('REPO_NAME')
BUILD_NAME = os.environ.get('BUILD_NAME')
PROP_CPCODE = os.environ.get('PROP_CPCODE')
EG_HOSTNAME = os.environ.get('EG_HOSTNAME')
EG_CLIENT_TOKEN = os.environ.get('EG_CLIENT_TOKEN')
EG_CLIENT_SECRET = os.environ.get('EG_CLIENT_SECRET')
EG_ACCESS_TOKEN = os.environ.get('EG_ACCESS_TOKEN')
artifact_filename = '{0}.zip'.format(BUILD_NAME)
local_source = os.path.join(os.getcwd(), artifact_filename)
netstorage_destination = '/{0}/{1}/{2}'.format(NS_CPCODE, REPO_NAME, artifact_filename)
## Upload to Netstorage
ns = Netstorage(NS_HOSTNAME, NS_KEYNAME, NS_KEY, True)
ok, response = ns.upload(local_source, netstorage_destination, True)
if not ok:
# Error occurred
print(response)
exit(1)
## Clear cache
session = requests.Session()
session.auth = EdgeGridAuth(
client_token=EG_CLIENT_TOKEN,
client_secret=EG_CLIENT_SECRET,
access_token=EG_ACCESS_TOKEN
)
## Purge the cache
purge_result = session.post(
urljoin(EG_HOSTNAME, '/ccu/v3/delete/cpcode/production'),
json={
"objects": [NS_CPCODE, PROP_CPCODE]
}
)
## Handle error from purge
if (purge_result.status_code != 201) :
print("Purge failed")
print(purge_result.reason)
print(purge_result.content)
exit(2)
## Sucessfully Completed.
print("Uploaded {0} successfully".format(artifact_filename))
exit(0)
## TODO: Post notice PR is ready for testing
uses: nciocpl/netstorage-upload-action@v1.0.0
with:
hostname: ${{ secrets.ns_hostname }}
cp-code: ${{ secrets.ns_cpcode }}
key-name: ${{ secrets.ns_keyname }}
key: ${{ secrets.ns_key }}
index-zip: true
local-path: ${{ format('{0}.zip', env.BUILD_NAME) }}
## Note this action automatically prepends the cpcode to the path.
destination-path: ${{ format('/{0}/{1}.zip', env.REPO_NAME, env.BUILD_NAME) }}
- name: Clear Site Cache
uses: nciocpl/akamai-purge-action@v1.0.2
with:
hostname: ${{ secrets.eg_hostname }}
client-token: ${{ secrets.eg_client_token }}
client-secret: ${{ secrets.eg_client_secret }}
access-token: ${{ secrets.eg_access_token }}
type: 'cpcodes'
ref: ${{ format('{0},{1}', secrets.ns_cpcode, secrets.prop_cpcode) }}
9 changes: 8 additions & 1 deletion .pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
"http://localhost:3000/expand/A",
"http://localhost:3000/def/dsadasda",
"http://localhost:3000/search/bev/?searchMode=Begins"
]
],
"chromeLaunchConfig": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-dev-shm-usage"
]
}
}
1 change: 0 additions & 1 deletion cypress/integration/TermPage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Feature: Term page
| property | content |
| og:title | NCI Drug Dictionary |
| og:url | http://localhost:3000/def/bevacizumab |
| robots | noindex |
And there is a canonical link with the href "https://www.cancer.gov/def/bevacizumab"

Scenario: Page Load Analytics fires when a user visits a term page.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nciocpl/drug-dictionary-app",
"version": "1.0.1",
"version": "1.0.2",
"description": "Drug Dictionary App",
"repository": {
"type": "git",
Expand Down
1 change: 0 additions & 1 deletion src/views/Definition/Definition.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const Definition = () => {
})
}
/>
<meta name="robots" content="noindex" />
</Helmet>
);
};
Expand Down

0 comments on commit 0dd12c4

Please sign in to comment.