diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 56aeb5a9..43045b29 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -1,26 +1,28 @@ -name: "csharp" +name: csharp on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main jobs: build-push: runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@master - with: - dotnet-version: 3.1.100 + - uses: actions/checkout@v2 + - uses: actions/setup-dotnet@master + with: + dotnet-version: 3.1.100 - - name: copy wechaty proto - run: .\copy.ps1 - working-directory: .\csharp\Wechaty.Grpc\buildTool - shell: powershell + - name: copy wechaty proto + run: .\copy.ps1 + working-directory: .\csharp\Wechaty.Grpc\buildTool + shell: powershell - - name: publish on version change - uses: rohith/publish-nuget@v2 - with: - PROJECT_FILE_PATH: .\csharp\Wechaty.Grpc\Wechaty.Grpc.csproj - VERSION_FILE_PATH: .\csharp\Wechaty.Grpc\common.props - NUGET_KEY: ${{ secrets.NUGET_APIKEY }} + - name: publish on version change + uses: rohith/publish-nuget@v2 + with: + PROJECT_FILE_PATH: .\csharp\Wechaty.Grpc\Wechaty.Grpc.csproj + VERSION_FILE_PATH: .\csharp\Wechaty.Grpc\common.props + NUGET_KEY: ${{ secrets.NUGET_APIKEY }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0a00bfeb..72feb138 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,36 +3,34 @@ name: Go on: [push, pull_request] jobs: - build: name: Build runs-on: ubuntu-latest steps: - - - name: Set up Go 1.14 - uses: actions/setup-go@master - with: - stable: false - go-version: 1.14 - id: go - - name: Install Protoc - uses: arduino/setup-protoc@master - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - cd go - make install - - - name: Build - run: | - cd go - make generate - rm -rf `go env GOPATH`/src/github.com/wechaty/go-grpc/wechaty - ln -s `pwd`/generated/wechaty/ `go env GOPATH`/src/github.com/wechaty/go-grpc/wechaty - go build -v generated/wechaty/puppet.pb.go + - name: Set up Go 1.14 + uses: actions/setup-go@master + with: + stable: false + go-version: 1.14 + id: go + - name: Install Protoc + uses: arduino/setup-protoc@master + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + cd go + make install + + - name: Build + run: | + cd go + make generate + rm -rf `go env GOPATH`/src/github.com/wechaty/go-grpc/wechaty + ln -s `pwd`/generated/wechaty/ `go env GOPATH`/src/github.com/wechaty/go-grpc/wechaty + go build -v generated/wechaty/puppet.pb.go publish: if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v')) @@ -40,25 +38,25 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - name: Set up Go 1.14 - uses: actions/setup-go@master - with: - stable: false - go-version: 1.14 - id: go - - name: Install Protoc - uses: arduino/setup-protoc@master - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Deploy - run: | - cd go - make install - # https://stackoverflow.com/a/4565746/1123955 - # https://stackoverflow.com/a/46253163/1123955 - ssh-agent bash -c "\ - echo '${SSH_PRIVATE_KEY}' | ssh-add - ;\ - make publish ;\ - " - env: - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Set up Go 1.14 + uses: actions/setup-go@master + with: + stable: false + go-version: 1.14 + id: go + - name: Install Protoc + uses: arduino/setup-protoc@master + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Deploy + run: | + cd go + make install + # https://stackoverflow.com/a/4565746/1123955 + # https://stackoverflow.com/a/46253163/1123955 + ssh-agent bash -c "\ + echo '${SSH_PRIVATE_KEY}' | ssh-add - ;\ + make publish ;\ + " + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 02dccee8..771e8b89 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -9,22 +9,21 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file - - name: Build with Maven - run: mvn -B package --file java/pom.xml + - name: Build with Maven + run: mvn -B package --file java/pom.xml - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c1b4ac09..708abe74 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -5,20 +5,21 @@ name: Maven on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Maven - run: mvn -B package --file java/pom.xml + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build with Maven + run: mvn -B package --file java/pom.xml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2be2013c..45eaf270 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,9 +5,11 @@ name: Node.js on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main jobs: build: @@ -23,31 +25,31 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@master - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: package.json - - name: Set up Go - uses: actions/setup-go@master - id: go - - - name: Install Protoc - uses: arduino/setup-protoc@master - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Dependencies - run: | - npm install - npm run install:protoc - - - name: Generate gRPC Stubs - run: npm run generate - - - name: Test - run: npm test - env: - CI: true + - uses: actions/checkout@master + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: package.json + - name: Set up Go + uses: actions/setup-go@master + id: go + + - name: Install Protoc + uses: arduino/setup-protoc@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Dependencies + run: | + npm install + npm run install:protoc + + - name: Generate gRPC Stubs + run: npm run generate + + - name: Test + run: npm test + env: + CI: true diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index aec31ec5..58f290a9 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -20,21 +20,21 @@ jobs: key: cache-v3 steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup PHP with extensions and custom config - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} - ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Shanghai - tools: protoc, grpc_php_plugin - - name: Testing PHP version - run: | - php -v - php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}" - - name: Test grpc_php_plugin and protoc - run: | - protoc --version - cd php - make generate + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP with extensions and custom config + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.extensions }} + ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Shanghai + tools: protoc, grpc_php_plugin + - name: Testing PHP version + run: | + php -v + php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}" + - name: Test grpc_php_plugin and protoc + run: | + protoc --version + cd php + make generate diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index dd5374e8..caf4f7c1 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -11,33 +11,33 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - uses: actions/cache@master - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('python/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: 3.9 + - uses: actions/cache@master + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('python/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install Protoc - uses: arduino/setup-protoc@master - - name: Install Protoc 3rd party protos - run: scripts/install-protoc.sh + - name: Install Protoc + uses: arduino/setup-protoc@master + - name: Install Protoc 3rd party protos + run: scripts/install-protoc.sh - - name: Install dependencies - run: | - cd python - python -m pip install --upgrade pip - make install - - name: Test - run: | - cd python - make generate - make test + - name: Install dependencies + run: | + cd python + python -m pip install --upgrade pip + make install + - name: Test + run: | + cd python + make generate + make test pack: name: Pack diff --git a/.vscode/settings.json b/.vscode/settings.json index d2802f65..76742561 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -46,7 +46,6 @@ } ] }, - "files.exclude": { "dist/": true, "doc/": true, @@ -62,7 +61,7 @@ "operatorPadding": "right", "indentBase": "firstline", "surroundSpace": { - "colon": [1, 1], // The first number specify how much space to add to the left, can be negative. The second number is how much space to the right, can be negative. + "colon": [1, 1], // The first number specify how much space to add to the left, can be negative. The second number is how much space to the right, can be negative. "assignment": [1, 1], // The same as above. "arrow": [1, 1], // The same as above. "comment": 2, // Special how much space to add between the trailing comment and the code. @@ -83,6 +82,4 @@ "setuptools" ], "python.linting.pylintEnabled": true, - } -