-
Notifications
You must be signed in to change notification settings - Fork 55
85 lines (70 loc) · 2.01 KB
/
maas-api-ci.yml
File metadata and controls
85 lines (70 loc) · 2.01 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
name: MaaS API
on:
push:
branches:
- main
pull_request:
paths:
- 'maas-api/**'
permissions:
actions: read
contents: read
env:
PROJECT_DIR: maas-api
defaults:
run:
working-directory: maas-api
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Align golangci-lint version with Makefile
id: golangci-version
run: |
VERSION=$(grep '^GOLANGCI_LINT_VERSION' tools.mk | cut -d'=' -f2 | tr -d ' ?')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v6
with:
go-version-file: maas-api/go.mod
cache: true
cache-dependency-path: maas-api/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: ${{ steps.golangci-version.outputs.version }}
working-directory: ${{ env.PROJECT_DIR }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: ${{ env.PROJECT_DIR }}/go.mod
cache: true
cache-dependency-path: ${{ env.PROJECT_DIR }}/go.sum
- name: Run tests
run: make test
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports
path: |
${{ env.PROJECT_DIR }}/coverage.out
${{ env.PROJECT_DIR }}/coverage.html
retention-days: 30
- name: Build image
run: make build-image
- name: Login to Quay.io
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.APP_QUAY_USERNAME }}
password: ${{ secrets.APP_QUAY_TOKEN }}
- name: Push image to Quay.io
if: github.event_name == 'push'
run: |
make build-push-image
make build-push-image -e TAG=${{ github.sha }}