Bump mypy from 1.11.2 to 1.12.0 #488
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [master] | |
tags: [v*] | |
pull_request: | |
branches: [master] | |
pull_request_target: | |
branches: [master] | |
jobs: | |
lint: | |
if: | | |
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || | |
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') | |
name: Linter | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Cache Python and its deps | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }} | |
path: ${{ env.pythonLocation }} | |
- name: Cache pre-commit hooks | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
make setup | |
- name: Run linters | |
run: | | |
echo Linting ${{ github.event.pull_request.head.sha || github.sha }} | |
make lint | |
- name: Save the package version | |
id: version | |
run: | | |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
test: | |
if: | | |
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || | |
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') | |
name: Run test | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Cache Python and its deps | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-python-3.11-${{ hashFiles('requirements/*.txt') }} | |
path: ${{ env.pythonLocation }} | |
- name: Cache pre-commit hooks | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-python-3.11-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
make setup | |
- name: Configure Neu.ro CLI | |
env: | |
NEURO_TOKEN: ${{ secrets.COOKIECUTTER_TEST_E2E_TOKEN }} | |
NEURO_STAGING_URL: ${{ secrets.NEURO_STAGING_URL }} | |
run: | | |
apolo config login-with-token ${{ env.NEURO_TOKEN }} ${{ env.NEURO_STAGING_URL }} | |
apolo config switch-cluster onprem-poc | |
- name: Run tests | |
env: | |
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }} | |
run: | | |
make test | |
deploy: | |
name: Build and push Docker image | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Sanity check for tag and version | |
run: | | |
export VERSION=${{ needs.lint.outputs.version }} | |
if [ "${{ github.ref }}" != "refs/tags/v$VERSION" ] | |
then | |
echo "Git tag '${{ github.ref }}' differs from hard-coded package version 'v$VERSION'" | |
exit 1 | |
else | |
echo "OK, git tag matches hard-coded package version: 'v$VERSION'" | |
fi | |
- name: Login to Github container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
env: | |
VERSION: ${{ needs.lint.outputs.version }} | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
run: | | |
docker build \ | |
-t "ghcr.io/neuro-inc/wabucketref:${VERSION}" \ | |
-t "ghcr.io/neuro-inc/wabucketref:latest" \ | |
--build-arg COMMIT_SHA=${COMMIT_SHA} \ | |
. | |
- name: Push | |
env: | |
VERSION: ${{ needs.lint.outputs.version }} | |
run: | | |
docker push ghcr.io/neuro-inc/wabucketref --all-tags |