-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (114 loc) · 4.91 KB
/
imagebuild.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build and Push Georust Docker Images
on:
push:
tags-ignore:
- '**'
branches:
- main
- staging
- trying
pull_request:
merge_group:
env:
LIBPROJ_VERSION: 9.4.0
MAIN_IMAGE_NAME: libproj-builder
jobs:
build_main_image:
name: Build the main image for geo and proj
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: ["1.74", "1.79", "1.80"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Up Builder
run: |
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
- name: Build and export main image to Docker
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ env.MAIN_IMAGE_NAME }}
push: false
load: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/${{ env.MAIN_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
- name: Push main image
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ env.MAIN_IMAGE_NAME }}
push: true
load: false
# platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ env.MAIN_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ env.MAIN_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
build_dependent_images:
name: Build dependent images for geo and proj
needs: build_main_image
runs-on: ubuntu-latest
strategy:
matrix:
subimages: [
{image: geo-ci, testcmd: "git clone https://github.com/georust/geo && cd geo && cargo test --no-default-features && cargo test && cargo test --all-features"},
{image: proj-ci, testcmd: "git clone https://github.com/georust/proj && cd proj && cargo test --no-default-features && cargo test --features bundled_proj && cargo test --features network && cd proj-sys && _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC=0 cargo test && _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC=1 cargo test --features bundled_proj"},
{image: proj-ci-without-system-proj, testcmd: "git clone https://github.com/georust/proj && cd proj && cargo test --features bundled_proj && cd proj-sys && _PROJ_SYS_TEST_EXPECT_BUILD_FROM_SRC=1 cargo test"}
]
rust_version: ["1.74", "1.79", "1.80"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Up Builder
run: |
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
- name: Build ${{ matrix.subimages.image }}
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ matrix.subimages.image }}
push: false
load: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.subimages.image }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
- name: Test ${{ matrix.subimages.image }}
run: |
docker run --rm ghcr.io/${{ github.repository_owner }}/${{ matrix.subimages.image }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }} /bin/bash -c "${{ matrix.subimages.testcmd }}"
- name: Push tested ${{ matrix.subimages.image }} image
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ matrix.subimages.image }}
push: true
load: false
# platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.subimages.image }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.subimages.image }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}