-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (91 loc) · 2.61 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI
on:
push:
branches: [master]
tags: [v*.*, v*.*.*]
pull_request:
branches: [master]
schedule:
- cron: 0 4 * * *
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Cache packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py-3.9-${{ hashFiles('setup.cfg') }}
- name: Install dependencies
run: make setup
- name: Login to ghcr.io
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Lint
run: make lint
- name: Run unit tests
run: make test_unit
- name: Run integration tests
run: make test_integration
- name: Build Docker image
run: make build/image
- name: Upload image artifact
uses: neuro-inc/[email protected]
with:
image: platformstorageapi
token: ${{ secrets.GITHUB_TOKEN }}
approve:
name: Approve bot PR
runs-on: ubuntu-latest
if: endsWith(github.actor, '[bot]')
needs: test
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: metadata
id: metadata
if: github.actor == 'dependabot[bot]'
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for bot PRs
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_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: platformstorageapi
helm_charts: platform-storage
deploy:
name: Deploy
needs: release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: neuro-inc/reuse/.github/workflows/[email protected]
secrets:
tf_api_token: ${{ secrets.TF_API_TOKEN }}
with:
environment: dev
dev_workspace: ${{ vars.DEV_TFC_WORKSPACE_JSON }}
variables: |
platform_storage_version=${{ needs.release.outputs.version }}