Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

build(deps): bump tj-actions/changed-files in /.github/workflows #1149

build(deps): bump tj-actions/changed-files in /.github/workflows

build(deps): bump tj-actions/changed-files in /.github/workflows #1149

Workflow file for this run

name: default
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/lint.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/lint.txt
- name: Lint with flake8
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/flake8-matcher.json"
fi
python -m flake8 src/ai/backend tests
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/typecheck.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/typecheck.txt
- name: Type check with mypy
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/mypy-matcher.json"
fi
python -m mypy --no-color-output src/ai/backend tests
test:
runs-on: ubuntu-latest
# runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "~3.10.2"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/test.txt
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
- name: Configure testing based on changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file" >> ./.changed-files.txt
done
python ./scripts/configure-test.py
echo "List of test sets to perform:"
ls -al ./.*.do-test || exit 0
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/test.txt
- name: Prepare testing
run: |
mkdir -p /tmp/etcd
docker run -d -p 2379:2379 -p 2380:2380 \
-v /tmp/etcd:/etcd-data \
--name backendai-etcd \
quay.io/coreos/etcd:v3.4.1 \
/usr/local/bin/etcd \
--name backendai-etcd \
--data-dir /etcd-data \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--initial-cluster backendai-etcd=http://0.0.0.0:2380 \
--initial-cluster-token backendai-etcd-token \
--initial-cluster-state new \
--auto-compaction-retention 1
- name: Register post-action to clean the temporary etcd container
uses: webiny/[email protected]
id: clean-temporary-etcd-container
with:
run: docker rm -f backendai-etcd
- name: Warm up docker-compose
run: |
mkdir -p $HOME/.docker/cli-plugins
curl -L "https://github.com/docker/compose/releases/download/v2.0.0-rc.3/docker-compose-linux-amd64" -o $HOME/.docker/cli-plugins/docker-compose
chmod +x $HOME/.docker/cli-plugins/docker-compose
if [ -f ".redis.do-test" ]; then
cp tests/redis/redis-cluster.yml tests/redis/redis-cluster.yml.bak
sed -i "s/host.docker.internal/127.0.0.1/g" tests/redis/redis-cluster.yml
sed -z -i "s/ports:\n - [0-9]\+:[0-9]\+/network_mode: host/g" tests/redis/redis-cluster.yml
docker compose -p xwarm -f tests/redis/redis-cluster.yml up -d
docker compose -p xwarm -f tests/redis/redis-cluster.yml ps
docker compose -p xwarm -f tests/redis/redis-cluster.yml down
cp tests/redis/redis-cluster.yml.bak tests/redis/redis-cluster.yml
fi
- name: Test with pytest
timeout-minutes: 6
run: |
function join_by { local IFS="$1"; shift; echo "$*"; }
test_args=()
if [ -f ".redis.do-test" ]; then
test_args+=("--do-test-redis")
fi
python -m pytest -v --cov=src $(join_by " " "${test_args[@]}")
- name: Send code coverage report
uses: codecov/codecov-action@v1
deploy-to-pypi:
needs: [lint, typecheck, test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/build.txt
- name: Install dependencies
env:
REQUIREMENTS_FILE: build
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/build.txt
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*