Skip to content

Check API client stubs #797

Check API client stubs

Check API client stubs #797

Workflow file for this run

# Copyright © 2022 IOTIC LABS LTD. [email protected]
#
# 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
#
# https://github.com/Iotic-Labs/iotics-grpc-client-py/blob/main/LICENSE
#
# 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.
name: Check API client stubs
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "0 7 * * *"
jobs:
# Ensure we can regenerate API stubs using the protocol buffer compiler.
regenerate:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
continue-on-error: true
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Generate client (stubs) files
# Install all dependencies and generate API stubs.
run: make build
- name: Check for changed files
uses: tj-actions/verify-changed-files@v10
id: verify-changed-files
with:
files: |
src/iotics/api
- name: Check that the generated files are unmodified
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: actions/github-script@v6
with:
script: |
core.setFailed("Modified files detected: ${{ steps.verify-changed-files.outputs.changed_files }}")
# Ensure package correctly imports dependencies and can communicate with the IOTICSpace.
verify:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
version: ['3.9', '3.10', '3.11']
fail-fast: true
max-parallel: 1
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.version }}
- name: Check out repository
uses: actions/checkout@v3
- name: Check that the package can be imported
run: make verify-import
- name: Mask secrets
run: |
echo "::add-mask::${{ secrets.SPACE }}"
echo "::add-mask::${{ secrets.USER_DID }}"
echo "::add-mask::${{ secrets.AGENT_DID }}"
echo "::add-mask::${{ secrets.AGENT_SECRET }}"
echo "::add-mask::${{ secrets.AGENT_KEY_NAME }}"
echo "::add-mask::${{ secrets.AGENT_NAME }}"
- name: Run examples
run: make run-examples
env:
SPACE: ${{ secrets.SPACE }}
USER_DID: ${{ secrets.USER_DID }}
AGENT_DID: ${{ secrets.AGENT_DID }}
AGENT_SECRET: ${{ secrets.AGENT_SECRET }}
AGENT_KEY_NAME: ${{ secrets.AGENT_KEY_NAME }}
AGENT_NAME: ${{ secrets.AGENT_NAME }}
TOKEN_TTL: 60