CI #3121
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] | |
schedule: | |
- cron: 0 4 * * * | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
AWS_REGION: us-east-1 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Cache packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-py-3.9-${{ hashFiles('pyproject.toml', 'setup.cfg', | |
'requirements/*.txt') }} | |
- name: Cache pre-commit hooks | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|py3.9|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: make setup | |
- name: Lint | |
run: | | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
make lint | |
- name: Run unit tests | |
run: make test_unit | |
- name: Login to ghcr.io | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Run integration tests | |
run: make test_integration | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: .coverage-integration.xml | |
flags: integration | |
name: codecov-integration | |
- name: Build Docker image | |
run: make docker_build | |
- name: Upload image artifact | |
uses: neuro-inc/[email protected] | |
with: | |
image: platformneuroflowapi | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: Create release | |
needs: test | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | |
uses: neuro-inc/reuse/.github/workflows/[email protected] | |
with: | |
image: platformneuroflowapi | |
helm_charts: platform-neuro-flow | |
deploy: | |
name: Deploy | |
needs: release | |
uses: neuro-inc/reuse/.github/workflows/[email protected] | |
secrets: | |
tf_api_token: ${{ secrets.TF_API_TOKEN }} | |
with: | |
environment: ${{ needs.release.outputs.prerelease == 'true' && 'dev' || 'prod' }} | |
dev_workspace: ${{ vars.DEV_TFC_WORKSPACE_JSON }} | |
prod_workspaces: ${{ vars.PROD_TFC_WORKSPACES_JSON }} | |
variables: | | |
platform_neuro_flow_version=${{ needs.release.outputs.version }} |