.github/workflows/test.yaml #350
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
# Copyright 2023 Google LLC | |
# | |
# 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://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. | |
on: | |
push: {} | |
schedule: | |
- cron: '27 22 * * 4' | |
jobs: | |
test: | |
strategy: | |
matrix: | |
python-version: | |
- '3.11' | |
- '3.12' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
# TODO(dseomn): Install protobuf-compiler from the system repos once the | |
# version there is new enough to work with the version of protobuf from | |
# pypi: https://protobuf.dev/news/2022-05-06/#python-updates | |
curl \ | |
--location \ | |
-o protoc.zip \ | |
https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip | |
sudo unzip protoc.zip -d /usr/local | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python package | |
run: | | |
python -m pip install --upgrade pip | |
pip install '.[test]' | |
- name: Lint | |
run: | | |
pip install pylint | |
pylint rock_paper_sand | |
- name: Check formatting | |
run: | | |
pip install black | |
black --check --diff . | |
- name: Check import order | |
run: | | |
pip install isort | |
isort --check --diff rock_paper_sand | |
- name: Check types | |
run: | | |
pip install mypy | |
mypy | |
- name: Test | |
run: | | |
pip install pytest pytest-cov | |
pytest | |
install-test: | |
strategy: | |
matrix: | |
python-version: | |
- '3.11' | |
- '3.12' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
# TODO(dseomn): Install protobuf-compiler from the system repos once the | |
# version there is new enough to work with the version of protobuf from | |
# pypi: https://protobuf.dev/news/2022-05-06/#python-updates | |
curl \ | |
--location \ | |
-o protoc.zip \ | |
https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip | |
sudo unzip protoc.zip -d /usr/local | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python package | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipx | |
pipx install . | |
- name: Smoke test | |
run: | | |
rock-paper-sand --config_file=examples/basic.config.yaml config lint |