Skip to content

Add allow_net and secrets support across SDKs #1012

Add allow_net and secrets support across SDKs

Add allow_net and secrets support across SDKs #1012

Workflow file for this run

name: Lint and Format
on:
push:
branches: [ main ]
paths:
- '**/*.rs'
- '**/*.py'
- '**/*.ts'
- '**/*.c'
- '**/*.h'
- '**/*.go'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'sdks/python/**'
- 'sdks/node/**'
- 'sdks/c/**'
- 'sdks/go/**'
- 'make/quality.mk'
- '.pre-commit-config.yaml'
- '.github/workflows/lint.yml'
- '.github/workflows/config.yml'
pull_request:
branches: [ main ]
paths:
- '**/*.rs'
- '**/*.py'
- '**/*.ts'
- '**/*.c'
- '**/*.h'
- '**/*.go'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'sdks/python/**'
- 'sdks/node/**'
- 'sdks/c/**'
- 'sdks/go/**'
- 'make/quality.mk'
- '.pre-commit-config.yaml'
- '.github/workflows/lint.yml'
- '.github/workflows/config.yml'
jobs:
config:
uses: ./.github/workflows/config.yml
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
python: ${{ steps.filter.outputs.python }}
node: ${{ steps.filter.outputs.node }}
c: ${{ steps.filter.outputs.c }}
go: ${{ steps.filter.outputs.go }}
quality: ${{ steps.filter.outputs.quality }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
python:
- 'sdks/python/**/*.py'
- 'sdks/python/pyproject.toml'
node:
- 'sdks/node/**/*.ts'
- 'sdks/node/package.json'
- 'sdks/node/tsconfig.json'
c:
- 'sdks/c/**/*.c'
- 'sdks/c/**/*.h'
- 'sdks/c/tests/CMakeLists.txt'
go:
- 'sdks/go/**/*.go'
- 'sdks/go/go.mod'
quality:
- 'make/quality.mk'
- '.pre-commit-config.yaml'
- '.github/workflows/lint.yml'
rustfmt:
name: Check Rust formatting
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: make fmt:check:rust
clippy:
name: Run Clippy on ${{ matrix.os }}
needs: [config, changes]
if: ${{ needs.changes.outputs.rust == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include: ${{ fromJson(needs.config.outputs.platforms) }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
- name: Install guest cross target (macOS)
if: runner.os == 'macOS'
run: rustup target add $(bash scripts/util.sh --target)
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools protobuf-compiler
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install protobuf
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Export GHA cache env vars
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', process.env.ACTIONS_CACHE_SERVICE_V2 || '');
core.exportVariable('CARGO_INCREMENTAL', '0');
- name: Run clippy checks
run: make clippy
python:
name: Python lint and format checks
needs: changes
if: ${{ needs.changes.outputs.python == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install ruff
run: pip install ruff
- name: Run Python lint
run: make lint:python
- name: Check Python formatting
run: make fmt:check:python
node:
name: Node.js lint and format checks
needs: changes
if: ${{ needs.changes.outputs.node == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: sdks/node
run: npm install
- name: Run Node lint
run: make lint:node
- name: Check Node formatting
run: make fmt:check:node
- name: Type check
working-directory: sdks/node
run: npx tsc --noEmit
c:
name: C SDK lint and format checks
needs: changes
if: ${{ needs.changes.outputs.c == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install clang tools
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy
- name: Run C lint
run: make lint:c
- name: Check C formatting
run: make fmt:check:c
go:
name: Go lint and format checks
needs: [config, changes]
if: ${{ needs.changes.outputs.go == 'true' || needs.changes.outputs.quality == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Check Go formatting
run: make fmt:check:go
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ needs.config.outputs.rust-toolchain }}
- name: Install build dependencies
run: make setup:build
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Export GHA cache env vars
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', process.env.ACTIONS_CACHE_SERVICE_V2 || '');
core.exportVariable('CARGO_INCREMENTAL', '0');
- name: Build Go SDK
run: make dev:go
- name: Run Go vet
run: make lint:go
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: sdks/go
args: --timeout=5m --build-tags boxlite_dev