-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (167 loc) · 5.89 KB
/
Copy pathci.yaml
File metadata and controls
201 lines (167 loc) · 5.89 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
env:
IMAGE_NAME: home
jobs:
format:
name: Format
runs-on: ubicloud-standard-2
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Install formatters
uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4
with:
install: true
cache: true
install_args: "\"cargo:taplo-cli\" dprint"
- name: Run formatters
run: |
mise format:ci
lint:
name: Lint
runs-on: ubicloud-standard-2
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Install linters
uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4
with:
install: true
cache: true
install_args: "\"cargo:taplo-cli\" \"npm:@infisical/cli\""
- name: Run linters
run: |
mise lint:ci --continue-on-error
type-check:
name: Type Check
runs-on: ubicloud-standard-2
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Run Fast Type Check
run: mise typecheck:ty
- name: Add .venv/bin to PATH
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run Slow Type Check
uses: jakebailey/pyright-action@8ec14b5cfe41f26e5f41686a31eb6012758217ef # v3
with:
version: PATH
project: ./pyrightconfig.json
test:
name: Test
runs-on: ubicloud-standard-2
permissions:
pull-requests: write
issues: write
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Run tests
if: ${{ github.event_name == 'pull_request'}}
run: |
mise run test:ci
- name: Create test summary
uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5 # v2
with:
show: "all"
paths: results/pytest-junit.xml
output: pytest-summary.md
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
- name: Wrap test summary in details
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
run: |
echo "<details>" > pytest-summary-wrapped.md
echo "" >> pytest-summary-wrapped.md
echo "<summary>Test Results</summary>" >> pytest-summary-wrapped.md
echo "" >> pytest-summary-wrapped.md
cat pytest-summary.md >> pytest-summary-wrapped.md
echo "" >> pytest-summary-wrapped.md
echo "</details>" >> pytest-summary-wrapped.md
mv pytest-summary-wrapped.md pytest-summary.md
- name: Update PR with test results
uses: ./.github/actions/find-update-or-create-comment
if: ${{ github.event_name == 'pull_request' && !cancelled() }}
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "Test Results"
comment-author: "github-actions[bot]"
body-path: pytest-summary.md
edit-mode: replace
- name: Run tests with coverage
if: ${{ !cancelled() }}
run: |
mise run test:cov
build:
name: Build Docker Image
runs-on: ubicloud-standard-2
needs: [test, lint, type-check, format]
permissions:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine branch name
id: branch
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "name=${{ github.head_ref }}" >> $GITHUB_OUTPUT
else
echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Extract metadata
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix=${{ steps.branch.outputs.name }}-,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
name: Deploy to Fly.io
runs-on: ubicloud-standard-2
needs: [build]
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Fly.io CLI
uses: superfly/flyctl-actions/setup-flyctl@63da3ecc5e2793b98a3f2519b3d75d4f4c11cec2
- name: Deploy to Fly.io
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}