-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19d1f02
commit fe4ab87
Showing
54 changed files
with
24,476 additions
and
12,834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,22 +9,26 @@ env: | |
CDN_URL: https://cdn.croct.io/js/v1/lib/plug.js | ||
PLAYGROUND_ORIGIN: https://play.croct.com | ||
PLAYGROUND_CONNECT_URL: https://play.croct.com/connect.html | ||
PREVIEW_WIDGET_ORIGIN: https://cdn.croct.io | ||
PREVIEW_WIDGET_PATH: js/v1/lib/plug/widget-${{ github.ref_name }}.html | ||
PREVIEW_WIDGET_URL: https://cdn.croct.io/js/v1/lib/plug/widget-${{ github.ref_name }}.html | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-18.04 | ||
deploy-library: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
node-version: 16 | ||
|
||
- name: Cache dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: node_modules-${{ hashFiles('**/package-lock.json', '**/package.json') }} | ||
key: node_modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: |- | ||
|
@@ -40,12 +44,11 @@ jobs: | |
cp package.json LICENSE README.md build/ | ||
cd build | ||
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json | ||
sed -i -e "s~<@cdnUrl@>~${CDN_URL}~" constants.js | ||
sed -i -e "s~<@cdnUrl@>~${CDN_URL}~" constants.d.ts | ||
sed -i -e "s~<@playgroundOrigin@>~${PLAYGROUND_ORIGIN}~" constants.js | ||
sed -i -e "s~<@playgroundOrigin@>~${PLAYGROUND_ORIGIN}~" constants.d.ts | ||
sed -i -e "s~<@playgroundConnectUrl@>~${PLAYGROUND_CONNECT_URL}~" constants.js | ||
sed -i -e "s~<@playgroundConnectUrl@>~${PLAYGROUND_CONNECT_URL}~" constants.d.ts | ||
sed -i -e "s~<@cdnUrl@>~${CDN_URL}~" constants.* | ||
sed -i -e "s~<@playgroundOrigin@>~${PLAYGROUND_ORIGIN}~" constants.* | ||
sed -i -e "s~<@playgroundConnectUrl@>~${PLAYGROUND_CONNECT_URL}~" constants.* | ||
sed -i -e "s~<@previewWidgetOrigin@>~${PREVIEW_WIDGET_ORIGIN}~" constants.* | ||
sed -i -e "s~<@previewWidgetUrl@>~${PREVIEW_WIDGET_URL}~" constants.* | ||
- name: Publish pre-release to NPM | ||
if: ${{ github.event.release.prerelease }} | ||
|
@@ -71,18 +74,67 @@ jobs: | |
rm -rf build | ||
npm run bundle -- --config-cdn-url=${CDN_URL} \ | ||
--config-playground-origin=${PLAYGROUND_ORIGIN} \ | ||
--config-playground-connect-url=${PLAYGROUND_CONNECT_URL} | ||
--config-playground-connect-url=${PLAYGROUND_CONNECT_URL} \ | ||
--config-preview-widget-origin=${PREVIEW_WIDGET_ORIGIN} \ | ||
--config-preview-widget-url=${PREVIEW_WIDGET_URL} | ||
- name: Authenticate to GCP | ||
if: ${{ !github.event.release.prerelease }} | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v0 | ||
|
||
- name: Deploy to GCS | ||
if: ${{ !github.event.release.prerelease }} | ||
env: | ||
GCLOUD_BUCKET: ${{ secrets.GCLOUD_BUCKET }} | ||
run: |- | ||
gsutil -m cp build/plug.min.js "gs://${GCLOUD_BUCKET}/js/v1/lib/plug.js" | ||
gsutil -m setmeta -h "Cache-Control: public, max-age=3600" "gs://${GCLOUD_BUCKET}/js/v1/lib/plug.js" | ||
deploy-preview-widget: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: preview | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Cache dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: node_modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: |- | ||
npm ci | ||
- name: Build package | ||
run: |- | ||
npm run build | ||
- name: Authenticate to GCP | ||
if: ${{ !github.event.release.prerelease }} | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v0 | ||
|
||
- name: Deploy to GCS | ||
if: ${{ !github.event.release.prerelease }} | ||
env: | ||
GCLOUD_BUCKET: ${{ secrets.GCLOUD_BUCKET }} | ||
run: |- | ||
gsutil -m cp dist/widget.html "gs://${GCLOUD_BUCKET}/${PREVIEW_WIDGET_PATH}" | ||
gsutil -m setmeta -h "Cache-Control: public, max-age=3600" "gs://${GCLOUD_BUCKET}/${PREVIEW_WIDGET_PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Preview validations | ||
|
||
on: | ||
push: | ||
tags-ignore: | ||
- '**' | ||
branches: | ||
- master | ||
pull_request: | ||
types: | ||
- synchronize | ||
- opened | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: preview | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Cache dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: preview/node_modules | ||
key: preview_node_modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: Check compilation errors | ||
run: npm run validate | ||
|
||
lint: | ||
needs: [ validate ] | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: preview | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Cache dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: preview/node_modules | ||
key: preview_node_modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: Check coding standard violations | ||
run: npm run lint | ||
|
||
test: | ||
needs: [ lint ] | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: preview | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Cache dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: preview/node_modules | ||
key: preview_node_modules-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Playwright test | ||
run: npm run test | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: preview/playwright-report/ | ||
retention-days: 30 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.