-
-
Notifications
You must be signed in to change notification settings - Fork 129
104 lines (104 loc) · 2.82 KB
/
ci.yml
File metadata and controls
104 lines (104 loc) · 2.82 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
---
name: CI
on:
pull_request:
branches: [main]
paths:
- .github/workflows/ci.yml
- shard.yml
- shard.lock
- Dockerfile
- "**/*.cr"
push:
branches: [main]
workflow_dispatch:
inputs:
logLevel:
description: manual run
required: false
default: ""
jobs:
build-crystal:
runs-on: ubuntu-latest
strategy:
matrix:
crystal-version: [1.19.0, 1.20.0]
steps:
- uses: actions/checkout@v6
- uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal-version }}
- name: Install dependencies
run: shards install
- name: Build
run: shards build
build-docker:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [linux/amd64, linux/arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v4.1.2
with:
cosign-release: v2.1.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v4
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
- name: Build Docker image
id: build-and-push
uses: docker/build-push-action@v7
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.arch }}
cache-from: type=gha,scope=${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run Ameba linter
uses: crystal-ameba/github-action@master
tests:
runs-on: ubuntu-latest
strategy:
matrix:
crystal-version: [1.19.0, 1.20.0]
steps:
- uses: actions/checkout@v6
- uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal-version }}
- name: Install dependencies
run: shards install
- name: Run unit tests
run: crystal spec spec/unit_test
- name: Run functional tests
run: crystal spec spec/functional_test
build-snapcraft:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
platform: [amd64]
steps:
- name: Check out Git repository
uses: actions/checkout@v6
- name: Build snapcraft package
uses: canonical/action-build@v1
id: build