Skip to content

Commit

Permalink
chore(ci): add fallback lint
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch committed Mar 4, 2024
1 parent 2508ca8 commit f28c441
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# run job on proper workflow event triggers (skip job for pull_request event from forks and only run pull_request_target for "tests: run" label)
if: "${{ (github.event.action != 'labeled' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) || github.event.label.name == 'tests: run' }}"

Expand All @@ -50,14 +53,18 @@ jobs:
} catch (e) {
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.11"
python-version: ${{ matrix.version }}

- name: Install requirements
run: pip install -r requirements.txt
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/lint_fallback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 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
#
# 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.

name: Lint
on:
pull_request:
paths:
- "*.md"

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: none

steps:
- run: echo "No tests required."
16 changes: 8 additions & 8 deletions integration.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@

steps:
- id: Install dependencies
name: python:3.11
name: python:3.8
entrypoint: pip
args: ["install", "--user", "-r", "requirements.txt"]

- id: Install module (and test requirements)
name: python:3.11
name: python:3.8
entrypoint: pip
args: ["install", ".[test]", "--user"]

- id: Run integration tests
name: python:3.11
name: python:3.8
entrypoint: python
args: ["-m", "pytest"]
env:
- 'PROJECT_ID=$PROJECT_ID'
- 'INSTANCE_ID=${_INSTANCE_ID}'
- 'GOOGLE_DATABASE=${_GOOGLE_DATABASE}'
- 'PG_DATABASE=${_PG_DATABASE}'
- 'TABLE_NAME=test_$BUILD_ID'
- "PROJECT_ID=$PROJECT_ID"
- "INSTANCE_ID=${_INSTANCE_ID}"
- "GOOGLE_DATABASE=${_GOOGLE_DATABASE}"
- "PG_DATABASE=${_PG_DATABASE}"
- "TABLE_NAME=test_$BUILD_ID"

substitutions:
_INSTANCE_ID: test-instance
Expand Down

0 comments on commit f28c441

Please sign in to comment.