From a9da92f22809b24149838b1c7ffa86f406e2c5be Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Thu, 27 Jan 2022 18:30:11 -0800 Subject: [PATCH 1/7] chore: added pull request packages documentation --- website/docs/pull_request_packages.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 website/docs/pull_request_packages.md diff --git a/website/docs/pull_request_packages.md b/website/docs/pull_request_packages.md new file mode 100644 index 000000000..bf8da1ed4 --- /dev/null +++ b/website/docs/pull_request_packages.md @@ -0,0 +1,18 @@ +--- +title: Pull request packages +--- + +# Pull Request npm packages + +After submitting a pull request to the `main` branch of the Taqueria repository, the CICD will start building and publishing `npm` packages to npmjs.com. The install instructions are then commented on the PR and will look similar to the following: + +| npm package installation instructions | +| ------------------------------------- | +| `npm install @taqueria/plugin-ligo@0.0.0-pr-155-d8b3d05` | +| `npm install @taqueria/plugin-smartpy@0.0.0-pr-155-d8b3d05` | +| `npm install @taqueria/plugin-taquito@0.0.0-pr-155-d8b3d05` | +| `npm install @taqueria/node-sdk@0.0.0-pr-155-d8b3d05` | + +The structure of the package name and version is as follows `{package_scope}/{package_name}@0.0.0-pr-{github_pr_number}-{github_commit_short_sha}`. The 0.0.0 version number is used because npm packages require a `semver` versioning scheme. + +Each plugin is published to npmjs.com with a tag that represents the current pull request number e.g. tag `pr-155` will be applied to all packages published in [PR #155](https://github.com/ecadlabs/taqueria/pull/155). This way, one can install the latest version of the packages for the pull request you are working on using a command like `npm install @taqueria/node-sdk@pr-155` \ No newline at end of file From 627c725d24fa7d746b7a8ad0e52e0b36d6fa0a89 Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Thu, 27 Jan 2022 18:42:32 -0800 Subject: [PATCH 2/7] chore: added package doc to sidebars.json --- website/sidebars.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/sidebars.js b/website/sidebars.js index f11227fc5..d83b14181 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -24,7 +24,8 @@ const sidebars = { collapsible: false, items: [ "intro", - "getting-started/installation" + "getting-started/installation", + "pull_request_packages" ], }, { From d6ce4aa0915e4189ca2ac15036c6e76d6ed2371d Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Thu, 27 Jan 2022 18:43:37 -0800 Subject: [PATCH 3/7] chore: temporarily removed comments --- .github/workflows/main.yml | 116 ++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aca3d66a6..976841ab8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -148,65 +148,65 @@ jobs: npm --no-git-tag-version version "${GITHUB_REF/refs\/tags\/v}" npm publish --tag 'latest' --access public - pr-comment: - runs-on: ubuntu-latest - needs: - - build-binaries - - build-and-publish-npm-packages - if: github.event_name == 'pull_request' - steps: - - uses: actions/checkout@v2 - - - name: create pr comment - uses: actions/github-script@v5 - id: pr-comment - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const fs = require('fs'); - - function readInfo(filePath) { - try { - const data = fs.readFileSync(filePath) - const JSONdata = JSON.parse(data.toString()) - const name = JSONdata.name.split("/")[1] - const version = JSONdata.version - return { name, version } - } catch (error) { - console.error(`Got an error trying to read the file: ${error.message}`) - } - } - - const ligo = readInfo("./taqueria-plugin-ligo/package.json") - const smartpy = readInfo("./taqueria-plugin-smartpy/package.json") - const taquito = readInfo("./taqueria-plugin-taquito/package.json") - const sdk = readInfo("./taqueria-sdk/package.json") - - const git_short_sha = "${{ github.sha }}".substring(1, 8) - const git_tag = "${{ github.ref }}".split('tags/')[1]; - - let body = ` - - - | Git Commit | Artifacts | - | ---------- | --------- | - | ${git_short_sha} | [Linux](${{ needs.build-binaries.outputs.public-url-ubuntu }})
[MacOS](${{ needs.build-binaries.outputs.public-url-macos }})
[Windows](${{ needs.build-binaries.outputs.public-url-windows }}) | - - - | npm package installation instructions | - | ------------------------------------- | - | npm install ${{ env.SCOPE }}/${ligo.name}@${ligo.version}-${{ github.event.number }}-${git_short_sha}| - | npm install ${{ env.SCOPE }}/${smartpy.name}@${smartpy.version}-${{ github.event.number }}-${git_short_sha}| - | npm install ${{ env.SCOPE }}/${taquito.name}@${taquito.version}-${{ github.event.number }}-${git_short_sha}| - | npm install ${{ env.SCOPE }}/${sdk.name}@${sdk.version}-${{ github.event.number }}-${git_short_sha}| - `; + # pr-comment: + # runs-on: ubuntu-latest + # needs: + # - build-binaries + # - build-and-publish-npm-packages + # if: github.event_name == 'pull_request' + # steps: + # - uses: actions/checkout@v2 + + # - name: create pr comment + # uses: actions/github-script@v5 + # id: pr-comment + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # const fs = require('fs'); + + # function readInfo(filePath) { + # try { + # const data = fs.readFileSync(filePath) + # const JSONdata = JSON.parse(data.toString()) + # const name = JSONdata.name.split("/")[1] + # const version = JSONdata.version + # return { name, version } + # } catch (error) { + # console.error(`Got an error trying to read the file: ${error.message}`) + # } + # } + + # const ligo = readInfo("./taqueria-plugin-ligo/package.json") + # const smartpy = readInfo("./taqueria-plugin-smartpy/package.json") + # const taquito = readInfo("./taqueria-plugin-taquito/package.json") + # const sdk = readInfo("./taqueria-sdk/package.json") + + # const git_short_sha = "${{ github.sha }}".substring(1, 8) + # const git_tag = "${{ github.ref }}".split('tags/')[1]; + + # let body = ` + + + # | Git Commit | Artifacts | + # | ---------- | --------- | + # | ${git_short_sha} | [Linux](${{ needs.build-binaries.outputs.public-url-ubuntu }})
[MacOS](${{ needs.build-binaries.outputs.public-url-macos }})
[Windows](${{ needs.build-binaries.outputs.public-url-windows }}) | + + + # | npm package installation instructions | + # | ------------------------------------- | + # | npm install ${{ env.SCOPE }}/${ligo.name}@${ligo.version}-${{ github.event.number }}-${git_short_sha}| + # | npm install ${{ env.SCOPE }}/${smartpy.name}@${smartpy.version}-${{ github.event.number }}-${git_short_sha}| + # | npm install ${{ env.SCOPE }}/${taquito.name}@${taquito.version}-${{ github.event.number }}-${git_short_sha}| + # | npm install ${{ env.SCOPE }}/${sdk.name}@${sdk.version}-${{ github.event.number }}-${git_short_sha}| + # `; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body - }) + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: body + # }) release: name: Release runs-on: ubuntu-latest From 571f9d5b748e9538f3e932c4322ee8065c227c1e Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Thu, 27 Jan 2022 18:58:18 -0800 Subject: [PATCH 4/7] chore: added some line breaks to the packages page --- website/docs/pull_request_packages.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/website/docs/pull_request_packages.md b/website/docs/pull_request_packages.md index bf8da1ed4..99ec105aa 100644 --- a/website/docs/pull_request_packages.md +++ b/website/docs/pull_request_packages.md @@ -13,6 +13,11 @@ After submitting a pull request to the `main` branch of the Taqueria repository, | `npm install @taqueria/plugin-taquito@0.0.0-pr-155-d8b3d05` | | `npm install @taqueria/node-sdk@0.0.0-pr-155-d8b3d05` | -The structure of the package name and version is as follows `{package_scope}/{package_name}@0.0.0-pr-{github_pr_number}-{github_commit_short_sha}`. The 0.0.0 version number is used because npm packages require a `semver` versioning scheme. +The structure of the package name and version is as follows -Each plugin is published to npmjs.com with a tag that represents the current pull request number e.g. tag `pr-155` will be applied to all packages published in [PR #155](https://github.com/ecadlabs/taqueria/pull/155). This way, one can install the latest version of the packages for the pull request you are working on using a command like `npm install @taqueria/node-sdk@pr-155` \ No newline at end of file +`{package_scope}/{package_name}@0.0.0-pr-{github_pr_number}-{github_commit_short_sha}`. + +The 0.0.0 version number is used because npm packages require a `semver` versioning scheme. + +Each plugin is published to npmjs.com with a tag that represents the current pull request number e.g. tag `pr-155` will be applied to all packages published in [PR #155](https://github.com/ecadlabs/taqueria/pull/155). This way, one can install the latest version of the packages for the pull request you are working on using a command like +`npm install @taqueria/node-sdk@pr-155` \ No newline at end of file From f8f3293d54347825420f658d09391a7670b80d44 Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Fri, 28 Jan 2022 15:08:08 -0800 Subject: [PATCH 5/7] chore: added Contributing section --- .github/workflows/main.yml | 116 +++++++++++++++++------------------ website/docusaurus.config.js | 7 +++ website/sidebars.js | 10 ++- 3 files changed, 74 insertions(+), 59 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 976841ab8..aca3d66a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -148,65 +148,65 @@ jobs: npm --no-git-tag-version version "${GITHUB_REF/refs\/tags\/v}" npm publish --tag 'latest' --access public - # pr-comment: - # runs-on: ubuntu-latest - # needs: - # - build-binaries - # - build-and-publish-npm-packages - # if: github.event_name == 'pull_request' - # steps: - # - uses: actions/checkout@v2 - - # - name: create pr comment - # uses: actions/github-script@v5 - # id: pr-comment - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # script: | - # const fs = require('fs'); - - # function readInfo(filePath) { - # try { - # const data = fs.readFileSync(filePath) - # const JSONdata = JSON.parse(data.toString()) - # const name = JSONdata.name.split("/")[1] - # const version = JSONdata.version - # return { name, version } - # } catch (error) { - # console.error(`Got an error trying to read the file: ${error.message}`) - # } - # } - - # const ligo = readInfo("./taqueria-plugin-ligo/package.json") - # const smartpy = readInfo("./taqueria-plugin-smartpy/package.json") - # const taquito = readInfo("./taqueria-plugin-taquito/package.json") - # const sdk = readInfo("./taqueria-sdk/package.json") - - # const git_short_sha = "${{ github.sha }}".substring(1, 8) - # const git_tag = "${{ github.ref }}".split('tags/')[1]; - - # let body = ` - - - # | Git Commit | Artifacts | - # | ---------- | --------- | - # | ${git_short_sha} | [Linux](${{ needs.build-binaries.outputs.public-url-ubuntu }})
[MacOS](${{ needs.build-binaries.outputs.public-url-macos }})
[Windows](${{ needs.build-binaries.outputs.public-url-windows }}) | - - - # | npm package installation instructions | - # | ------------------------------------- | - # | npm install ${{ env.SCOPE }}/${ligo.name}@${ligo.version}-${{ github.event.number }}-${git_short_sha}| - # | npm install ${{ env.SCOPE }}/${smartpy.name}@${smartpy.version}-${{ github.event.number }}-${git_short_sha}| - # | npm install ${{ env.SCOPE }}/${taquito.name}@${taquito.version}-${{ github.event.number }}-${git_short_sha}| - # | npm install ${{ env.SCOPE }}/${sdk.name}@${sdk.version}-${{ github.event.number }}-${git_short_sha}| - # `; + pr-comment: + runs-on: ubuntu-latest + needs: + - build-binaries + - build-and-publish-npm-packages + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v2 + + - name: create pr comment + uses: actions/github-script@v5 + id: pr-comment + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + + function readInfo(filePath) { + try { + const data = fs.readFileSync(filePath) + const JSONdata = JSON.parse(data.toString()) + const name = JSONdata.name.split("/")[1] + const version = JSONdata.version + return { name, version } + } catch (error) { + console.error(`Got an error trying to read the file: ${error.message}`) + } + } + + const ligo = readInfo("./taqueria-plugin-ligo/package.json") + const smartpy = readInfo("./taqueria-plugin-smartpy/package.json") + const taquito = readInfo("./taqueria-plugin-taquito/package.json") + const sdk = readInfo("./taqueria-sdk/package.json") + + const git_short_sha = "${{ github.sha }}".substring(1, 8) + const git_tag = "${{ github.ref }}".split('tags/')[1]; + + let body = ` + + + | Git Commit | Artifacts | + | ---------- | --------- | + | ${git_short_sha} | [Linux](${{ needs.build-binaries.outputs.public-url-ubuntu }})
[MacOS](${{ needs.build-binaries.outputs.public-url-macos }})
[Windows](${{ needs.build-binaries.outputs.public-url-windows }}) | + + + | npm package installation instructions | + | ------------------------------------- | + | npm install ${{ env.SCOPE }}/${ligo.name}@${ligo.version}-${{ github.event.number }}-${git_short_sha}| + | npm install ${{ env.SCOPE }}/${smartpy.name}@${smartpy.version}-${{ github.event.number }}-${git_short_sha}| + | npm install ${{ env.SCOPE }}/${taquito.name}@${taquito.version}-${{ github.event.number }}-${git_short_sha}| + | npm install ${{ env.SCOPE }}/${sdk.name}@${sdk.version}-${{ github.event.number }}-${git_short_sha}| + `; - # github.rest.issues.createComment({ - # issue_number: context.issue.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: body - # }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }) release: name: Release runs-on: ubuntu-latest diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index fc40bbb69..1444583aa 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -87,6 +87,13 @@ const config = { label: "Docs", className: "header-link", }, + { + type: "doc", + docId: "contributing", + position: "right", + label: "Contributing", + className: "header-link", + }, { type: "doc", docId: "plugins", diff --git a/website/sidebars.js b/website/sidebars.js index d83b14181..9a77147f2 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -24,7 +24,15 @@ const sidebars = { collapsible: false, items: [ "intro", - "getting-started/installation", + "getting-started/installation" + ], + }, + type: "category", + label: "Contributing", + className: "sidebarHeader", + collapsed: false, + collapsible: false, + items: [ "pull_request_packages" ], }, From ac75c33e934890e592e46fa6c6f53e6fcbfb277c Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Fri, 28 Jan 2022 15:35:33 -0800 Subject: [PATCH 6/7] chore: reverted all docusaurus packages --- website/docusaurus.config.js | 7 ------- website/sidebars.js | 9 --------- 2 files changed, 16 deletions(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 1444583aa..fc40bbb69 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -87,13 +87,6 @@ const config = { label: "Docs", className: "header-link", }, - { - type: "doc", - docId: "contributing", - position: "right", - label: "Contributing", - className: "header-link", - }, { type: "doc", docId: "plugins", diff --git a/website/sidebars.js b/website/sidebars.js index 9a77147f2..f11227fc5 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -26,15 +26,6 @@ const sidebars = { "intro", "getting-started/installation" ], - }, - type: "category", - label: "Contributing", - className: "sidebarHeader", - collapsed: false, - collapsible: false, - items: [ - "pull_request_packages" - ], }, { type: "category", From 534fa9ee13d5216afb135dd0521b1d78d106fb4c Mon Sep 17 00:00:00 2001 From: GImbrailo Date: Fri, 28 Jan 2022 15:40:34 -0800 Subject: [PATCH 7/7] chore: change documentation to remove references to a pr-# tag --- website/docs/pull_request_packages.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/website/docs/pull_request_packages.md b/website/docs/pull_request_packages.md index 99ec105aa..64546ec94 100644 --- a/website/docs/pull_request_packages.md +++ b/website/docs/pull_request_packages.md @@ -17,7 +17,6 @@ The structure of the package name and version is as follows `{package_scope}/{package_name}@0.0.0-pr-{github_pr_number}-{github_commit_short_sha}`. -The 0.0.0 version number is used because npm packages require a `semver` versioning scheme. +All information regarding the pull request and the commit that triggered the build is available in the package version name. The 0.0.0 version number is used because npm packages require a `semver` versioning scheme. -Each plugin is published to npmjs.com with a tag that represents the current pull request number e.g. tag `pr-155` will be applied to all packages published in [PR #155](https://github.com/ecadlabs/taqueria/pull/155). This way, one can install the latest version of the packages for the pull request you are working on using a command like -`npm install @taqueria/node-sdk@pr-155` \ No newline at end of file +Each plugin is published to npmjs.com with the `preview` tag and one can install the latest version using `npm install @taqueria/node-sdk@preview` \ No newline at end of file