-
Notifications
You must be signed in to change notification settings - Fork 45
75 lines (75 loc) · 2.06 KB
/
ci.yml
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
---
name: CI
on:
pull_request_target:
branches: [main, dev]
paths: ['**/*.cr', shard.yml, Dockerfile]
jobs:
build-crystal:
runs-on: ubuntu-latest
strategy:
matrix:
crystal-version: [1.10.1, 1.11.2, 1.12.2, 1.13.3, 1.14.0]
steps:
- uses: actions/checkout@v4
- uses: MeilCli/setup-crystal-action@v4
with:
crystal_version: ${{ 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@v4
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.1.1
with:
cosign-release: v2.1.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.arch }}
cache-from: type=gha
cache-to: type=gha,mode=max
lint:
runs-on: ubuntu-latest
container:
image: crystallang/crystal
steps:
- uses: actions/checkout@v3
- name: Crystal Ameba Linter
id: crystal-ameba
uses: crystal-ameba/github-action@v0.8.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tests:
runs-on: ubuntu-latest
container:
image: crystallang/crystal
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: shards install
- name: Run tests
run: crystal spec