This repository was archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Jim/FEQ-703/convert-circleci-config-on-deriv-api-docs-to-github-workflow #250
Merged
ali-hosseini-deriv
merged 33 commits into
binary-com:master
from
jim-deriv:Jim/FEQ-703/convert-circleci-config-on-deriv-api-docs-to-github-workflow
Oct 12, 2023
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8919b7b
ci: add actions
jim-deriv e99a075
ci: add workflows
jim-deriv cc4b26c
build: use node 16 in actions/setup_node
jim-deriv fe4ff9c
ci: upgrade wrangler
jim-deriv 666fb16
chore: add new line at the end of the file
jim-deriv 88daf13
chore: add new line at the end of the file
jim-deriv 6b25d4a
chore: update tag matcher
jim-deriv 3477a12
chore: format yaml
jim-deriv 7e76341
chore: remove circleci config
jim-deriv f745a4b
chore: remove unused environment variables
jim-deriv 2e2b915
feat: add readVersion step
jim-deriv 57bcf4a
chore: use the readVersion step
jim-deriv 1a0e165
chore: use the readVersion step and remove unused ca environment vari…
jim-deriv bba1732
ci: fix file read command
jim-deriv a55f79e
build: remove unnecessary step
jim-deriv c4ee7f7
build: remove unnecessary step
jim-deriv 63a92c3
chore: remove unused environment variables
jim-deriv 5945106
Revert "chore: remove circleci config"
jim-deriv 50299e0
chore: capitalise all input names
jim-deriv 7bd1f9f
ci: add step to save cache
jim-deriv 6796ff4
ci: replace codecov with coveralls
jim-deriv 30348bd
chore: update workflow name
jim-deriv a283dc3
chore: use ubuntu-latest as the runner
jim-deriv 065db58
chore: update path
jim-deriv b02e7c7
chore: update key
jim-deriv f522cb9
chore: add command to collect coverage
jim-deriv 844a591
docs: update badge
jim-deriv d35cc9e
chore: update badge link
jim-deriv c640c94
docs: add branch name
jim-deriv e8310d1
Merge branch 'master' of https://github.com/binary-com/deriv-api-docs…
ali-hosseini-deriv 87e71bc
ci: fix node_modules cache
ali-hosseini-deriv 1afd5c1
ci: fix slack notification
ali-hosseini-deriv 525b72f
ci: make it to one line command
ali-hosseini-deriv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,15 @@ | ||
| name: build | ||
| description: Build Docusaurus project | ||
| inputs: | ||
| NODE_ENV: | ||
| description: Node environment | ||
| required: false | ||
| default: staging | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Building Docusaurus project | ||
| env: | ||
| NODE_ENV: ${{ inputs.NODE_ENV }} | ||
| run: npm run build | ||
| shell: bash |
This file contains hidden or 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,10 @@ | ||
| name: invalidate_npm_cache | ||
| description: Invalidate the Master NPM cache | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: save_cache | ||
| uses: actions/cache/save@v3 | ||
| with: | ||
| path: ./node_modules | ||
| key: ${{ runner.os }}-node_modules-${{ hashFiles('./package-lock.json') }} | ||
This file contains hidden or 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,37 @@ | ||
| name: notify_slack | ||
| description: Send Slack notifications | ||
| inputs: | ||
| SLACK_WEBHOOK_URL: | ||
| description: Slack webhook URL | ||
| required: true | ||
| STATUS: | ||
| description: Job status | ||
| required: true | ||
| RELEASE_TYPE: | ||
| description: Release type | ||
| required: true | ||
| VERSION: | ||
| description: Version | ||
| required: true | ||
| default: N/A | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Send Slack Notification on Success | ||
| if: ${{ inputs.STATUS == 'success' }} | ||
| run: |- | ||
| curl -X POST -H 'Content-type: application/json' \ | ||
| --data '{ | ||
| "text": "'"${{ inputs.RELEASE_TYPE }}"' Release succeeded for api.deriv.com with version *'"${{ inputs.VERSION }}"'*" | ||
| }' \ | ||
| ${{ inputs.SLACK_WEBHOOK_URL }} | ||
| shell: bash | ||
| - name: Send Slack Notification on Failure | ||
| if: ${{ inputs.STATUS == 'failure' }} | ||
| run: |- | ||
| curl -X POST -H 'Content-type: application/json' \ | ||
| --data '{ | ||
| "text": "'"${{ inputs.RELEASE_TYPE }}"' Release failed for api.deriv.com with version *'"${{ inputs.VERSION }}"'*" | ||
| }' \ | ||
| ${{ inputs.SLACK_WEBHOOK_URL }} | ||
| shell: bash |
This file contains hidden or 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,15 @@ | ||
| name: npm_install_from_cache | ||
| description: Install npm packages from cache | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Cache node modules | ||
| id: cache-nodemodules | ||
| uses: actions/cache/restore@v3 | ||
| with: | ||
| path: node_modules | ||
| key: ${{ runner.os }}-node_modules-${{ hashFiles('./package-lock.json') }} | ||
| - name: Install npm dependencies | ||
| if: steps.cache-nodemodules.outputs.cache-hit != 'true' | ||
| run: npm install | ||
| shell: bash |
This file contains hidden or 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,22 @@ | ||
| name: publish_to_pages_production | ||
| description: Publish to cloudflare pages (production) | ||
| inputs: | ||
| CLOUDFLARE_ACCOUNT_ID: | ||
| description: Cloudflare account id | ||
| required: true | ||
| CLOUDFLARE_API_TOKEN: | ||
| description: Cloudflare token | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Publish to cloudflare pages (production) | ||
| env: | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
| CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
| run: |- | ||
| npm i wrangler@3.10.1 | ||
| cd build | ||
| npx wrangler pages deploy . --project-name=deriv-developers-portal-pages --branch=main | ||
| echo "New website - https://api.deriv.com" | ||
| shell: bash |
This file contains hidden or 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,22 @@ | ||
| name: publish_to_pages_staging | ||
| description: Publishes to cloudflare pages (staging) | ||
| inputs: | ||
| CLOUDFLARE_ACCOUNT_ID: | ||
| description: Cloudflare account id | ||
| required: true | ||
| CLOUDFLARE_API_TOKEN: | ||
| description: Cloudflare token | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Publish to cloudflare pages (staging) | ||
| env: | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
| CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
| run: |- | ||
| npm i wrangler@3.10.1 | ||
| cd build | ||
| npx wrangler pages deploy . --project-name=deriv-developers-portal-pages --branch=staging | ||
| echo "New staging website - https://staging-api.deriv.com/" | ||
| shell: bash |
This file contains hidden or 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,9 @@ | ||
| name: Setup Node | ||
| description: Sets up Node.js | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Use Node.js 16.x | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16.x |
This file contains hidden or 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,13 @@ | ||
| name: versioning | ||
| description: Generates a version for the build | ||
| inputs: | ||
| RELEASE_TYPE: | ||
| description: Release Type | ||
| required: false | ||
| default: staging | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Tag build | ||
| run: echo "${{ inputs.RELEASE_TYPE }} $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > build/version | ||
| shell: bash |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,25 @@ | ||
| name: Coveralls Workflow | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
| push: | ||
| branches: | ||
| - master | ||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest # TODO: Replace this with the appropriate runner for Deriv-Api-Docs when provided | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: './.github/actions/setup_node' | ||
| - name: Install dependencies | ||
| uses: './.github/actions/npm_install_from_cache' | ||
| - name: Build | ||
| uses: ./.github/actions/build | ||
| - name: Run Tests | ||
| run: npm run test -- --collectCoverage | ||
| - name: Coveralls | ||
| uses: coverallsapp/github-action@v2 |
This file contains hidden or 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,54 @@ | ||
| name: Deriv Api Docs Production Workflow | ||
| on: | ||
| push: | ||
| tags: | ||
| - production_v* | ||
| jobs: | ||
| build_and_publish: | ||
| name: Builds and Publishes to Cloudflare Pages Production | ||
| environment: Production | ||
| runs-on: ubuntu-latest # TODO: Replace this with the appropriate runner for Deriv-Api-Docs when provided | ||
| outputs: | ||
| RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: ./.github/actions/setup_node | ||
| - name: Install dependencies | ||
| uses: ./.github/actions/npm_install_from_cache | ||
| - name: Build | ||
| uses: ./.github/actions/build | ||
| with: | ||
| NODE_ENV: production | ||
| - name: Versioning | ||
| uses: ./.github/actions/versioning | ||
| with: | ||
| RELEASE_TYPE: production | ||
| - name: Extract version | ||
| id: extract_version | ||
| run: echo "RELEASE_VERSION=$(cat build/version)" >> $GITHUB_OUTPUT | ||
| - name: Publish to Cloudflare Pages Production | ||
| uses: ./.github/actions/publish_to_pages_production | ||
| with: | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| send_slack_notification: | ||
| name: Send Slack Notification | ||
| environment: Production | ||
| runs-on: ubuntu-latest # TODO: Replace this with the appropriate runner for Deriv-Api-Docs when provided | ||
| if: always() | ||
| needs: | ||
| - build_and_publish | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Conclusion | ||
| uses: technote-space/workflow-conclusion-action@v3 | ||
| - name: Send Slack Notification | ||
| uses: ./.github/actions/notify_slack | ||
| with: | ||
| RELEASE_TYPE: Production | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| STATUS: ${{ env.WORKFLOW_CONCLUSION }} | ||
| version: ${{ needs.build_and_publish.outputs.RELEASE_VERSION}} |
This file contains hidden or 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,28 @@ | ||
| name: Deriv Api Docs Staging Workflow | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| jobs: | ||
| build_and_publish: | ||
| name: Builds and Publishes to Cloudflare Pages Staging | ||
| runs-on: ubuntu-latest # TODO: Replace this with the appropriate runner for Deriv-Api-Docs when provided | ||
| environment: Staging | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: ./.github/actions/setup_node | ||
| - name: Install Dependencies | ||
| uses: ./.github/actions/npm_install_from_cache | ||
| - name: Invalidate Cache | ||
| uses: ./.github/actions/invalidate_master_cache | ||
| - name: Build | ||
| uses: ./.github/actions/build | ||
| with: | ||
| NODE_ENV: staging | ||
| - name: Publish to Cloudflare Pages Staging | ||
| uses: ./.github/actions/publish_to_pages_staging | ||
| with: | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.