-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (57 loc) · 1.85 KB
/
main.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
name: ci
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- 1.78.0
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --verbose
- run: cargo test --verbose -- --skip util::geo_ip::tests::test_get_country_code
docker:
runs-on: ubuntu-latest
needs: test
steps:
# See https://web.archive.org/web/20240729104252/https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/Bastian/bstats-data-processor
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
# See https://web.archive.org/web/20240709084932/https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64 #,linux/arm64 (arm disabled because it takes forever)
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max