-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
24 changed files
with
2,216 additions
and
2,895 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Publish on tag | ||
on: | ||
pull_request: | ||
push: | ||
tags: [v*] | ||
workflow_dispatch: | ||
|
||
env: | ||
HTTPS_REMOTE: "https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | ||
|
||
jobs: | ||
publish: | ||
name: Publish Release | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- name: Install Dependencies | ||
run: npm i | ||
- name: Set up version | ||
run: | | ||
# Extract package name and version | ||
NPM_PACKAGE_NAME=$(node -p "require('./package.json').name") | ||
NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc | ||
- name: publish-stream | ||
run: | | ||
npm i | ||
npm run build | ||
# Publish to NPM registry | ||
npm publish --access public | ||
bump-version: | ||
needs: [publish] | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | ||
name: Bump SDK Version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: "main" | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Install tools | ||
run: npm i -g semver | ||
- name: Configure Git | ||
run: | | ||
git config --global user.name "galachain-release-bot" | ||
git config --global user.email "[email protected]" | ||
- name: Set a new version | ||
run: | | ||
VERSION="$(semver "$(< package.json jq -r '.version')" -i)" | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create a new branch | ||
run: | | ||
BRANCH_NAME="bump-version-to-$VERSION" | ||
git checkout -b $BRANCH_NAME main | ||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
- name: Bump version and commit changes | ||
run: | | ||
npm version $VERSION | ||
npm i | ||
git commit -am "Bump version to $VERSION" | ||
git push --set-upstream origin bump-version-to-$VERSION | ||
- name: Create Pull Request | ||
env: | ||
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }} | ||
run: gh pr create --title "Bump Version to $VERSION" --body "Bump Version to $VERSION" --label "bump-version-pr" --head "bump-version-to-$VERSION" --base main |
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,71 @@ | ||
name: Test on push | ||
on: | ||
push: | ||
tags: [v*] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Verify copyright | ||
run: ./verify_copyright.sh | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Build | ||
run: npm run build | ||
- name: Lint | ||
run: npm run lint | ||
|
||
e2e-ci: | ||
name: Run e2e test | ||
runs-on: ubuntu-latest | ||
needs: [ci] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.20.5 | ||
- name: Cache Docker images | ||
uses: ScribeMD/[email protected] | ||
with: | ||
key: docker-${{ runner.os }}-${{ github.ref_name }} | ||
- name: Install local CLI | ||
run: npm install -g @gala-chain/cli | ||
- name: Create test project | ||
run: galachain init ./test-chaincode | ||
- name: Install dependencies | ||
run: | | ||
unset npm_config_prefix | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
nvm install 18.20.5 | ||
npm i | ||
npm i --prefix ./test-chaincode | ||
(cd test-chaincode && npm run network:up && cd ..) | ||
- name: Run e2e tests | ||
run: npm run test:e2e --prefix ./test-chaincode | ||
- name: Stream blocks from the network | ||
run: | ||
timeout 15s npx ts-node src/sample.ts || true | ||
- name: Test | ||
run: | | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
nvm install 22 | ||
npm run build | ||
npm run test | ||
- name: Clean-up | ||
run: (cd test-chaincode && npm run network:prune) |
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 |
---|---|---|
@@ -1 +1 @@ | ||
18 | ||
22 |
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,57 @@ | ||
/* | ||
* Copyright (c) Gala Games Inc. All rights reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import js from "@eslint/js"; | ||
import * as tsPlugin from "@typescript-eslint/eslint-plugin"; | ||
import * as tsParser from "@typescript-eslint/parser"; | ||
import prettierPlugin from "eslint-plugin-prettier"; | ||
import globals from "globals"; | ||
|
||
export default [ | ||
{ | ||
ignores: ["lib/*", "node_modules/*", "src/cli.ts", "**/*.d.ts"] | ||
}, | ||
{ | ||
files: ["*.js", "*.jsx", "*.ts", "*.tsx"], | ||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
globals: { | ||
...globals.es2021, | ||
...globals.node | ||
} | ||
}, | ||
plugins: { | ||
"@typescript-eslint": tsPlugin, | ||
prettier: prettierPlugin | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
...tsPlugin.configs["eslint-recommended"].overrides[0].rules, | ||
...tsPlugin.configs.recommended.rules, | ||
...prettierPlugin.configs.recommended.rules, | ||
"prettier/prettier": "error", | ||
"@typescript-eslint/no-unused-vars": "warn" | ||
} | ||
}, | ||
{ | ||
files: ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], | ||
languageOptions: { | ||
globals: { | ||
...globals.jest | ||
} | ||
} | ||
} | ||
]; |
Oops, something went wrong.