Repository navigation
86 lines (83 loc) · 2.83 KB
/
Copy pathcrates-postgres.yaml
File metadata and controls
86 lines (83 loc) · 2.83 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
name: crates-postgres
on:
workflow_dispatch:
push:
paths:
- 'crates/pg/**'
branches-ignore:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: crates/pg
runs-on: ubuntu-latest
permissions:
packages: read
steps:
- uses: actions/checkout@v4
- name: login to ghcr
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: restore base images
id: base-images
uses: actions/cache@v5
with:
path: ~/image-cache/base-images.tar
key: base-images-redis-v1
- name: pull and cache base images
if: steps.base-images.outputs.cache-hit != 'true'
run: |
mkdir -p ~/image-cache
docker pull ghcr.io/systemaccounting/redis:latest
docker tag ghcr.io/systemaccounting/redis:latest public.ecr.aws/bitnami/redis:latest
docker save -o ~/image-cache/base-images.tar public.ecr.aws/bitnami/redis:latest
- name: load base images
if: steps.base-images.outputs.cache-hit == 'true'
run: docker load -i ~/image-cache/base-images.tar
- name: restore postgres base stage
id: pg-base
uses: actions/cache@v5
with:
path: ~/image-cache/postgres-base.tar
key: postgres-base-${{ hashFiles('docker/bitnami-postgres.Dockerfile') }}
- name: build postgres base stage
if: steps.pg-base.outputs.cache-hit != 'true'
run: |
mkdir -p ~/image-cache
docker build \
--target base \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t mxf-postgres-base \
-f docker/bitnami-postgres.Dockerfile .
docker save -o ~/image-cache/postgres-base.tar mxf-postgres-base
- name: load postgres base stage
if: steps.pg-base.outputs.cache-hit == 'true'
run: docker load -i ~/image-cache/postgres-base.tar
- name: build postgres image
run: |
docker build \
--cache-from mxf-postgres-base \
-t mxf-postgres \
-f docker/bitnami-postgres.Dockerfile .
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: stop runner postgres
run: sudo systemctl stop postgresql
- name: crates/pg lint tests
run: make -C ./crates/pg test-lint
- name: crates/pg unit tests
run: make -C ./crates/pg test-unit
- name: start postgres
run: make -C migrations start-nobuild
- name: crates/pg db_tests
run: make -C ./crates/pg test-db
- name: crates/pg clean up
run: make -C ./crates/pg stop