-
Notifications
You must be signed in to change notification settings - Fork 3
94 lines (76 loc) · 2.28 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build Ratings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config protobuf-compiler docker-compose
- name: Check code formating
uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Clippy linting
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-review"
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Dependencies security audit
uses: actions-rust-lang/audit@v1
with:
ignore: RUSTSEC-2023-0071 # patch not available att
- name: Setup and Run Tests
run: make ci-test
publish:
if: github.event_name == 'push'
name: Publish to ghcr.io
needs: build
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config protobuf-compiler
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Log in to gchr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for image labels and tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=sha,format=short
- name: Build rock
uses: canonical/craft-actions/rockcraft-pack@main
id: rockcraft
- name: Publish rock to GHCR
run: |
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker://ghcr.io/${{ steps.meta.outputs.tags }}