forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 9
178 lines (158 loc) · 6.49 KB
/
build-rust-mos-image.yml
File metadata and controls
178 lines (158 loc) · 6.49 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: build_rust_mos_docker_image
on:
workflow_dispatch:
inputs:
llvm_mos_repo:
description: 'llvm-mos repo'
default: 'llvm-mos/llvm-mos'
type: string
llvm_mos_sdk_repo:
description: 'llvm-mos-sdk repo'
default: 'llvm-mos/llvm-mos-sdk'
type: string
llvm_mos_ref:
description: 'llvm-mos ref'
default: '7c0751c5b1e2fd62e1e0e358e9e853903f876920'
type: string
llvm_mos_sdk_ref:
description: 'llvm-mos-sdk ref'
default: '334fc9823745284938bfba543112f95bfb489b50'
type: string
rust_mos_sha:
description: 'rust_mos_sha (last part of image name)'
# default: '21ee0734'
type: string
jobs:
amd64_image:
if: ${{ false }}
uses: ./.github/workflows/cross-build-llvm-mos.yml
with:
arch: amd64
llvm_mos_repo: ${{ inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ inputs.llvm_mos_sdk_ref }}
secrets: inherit
arm64_image_tmp:
if: ${{ false }}
uses: ./.github/workflows/cross-build-llvm-mos.yml
with:
arch: arm64
arch_suffix: -tmp
llvm_mos_repo: ${{ inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ inputs.llvm_mos_sdk_ref }}
secrets: inherit
arm64_image:
if: ${{ false }}
runs-on: ubuntu-latest
needs:
- amd64_image
- arm64_image_tmp
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Set short sha
id: short_sha
run: |
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: Build and push fixed arm image
id: build_fixed_arm_image
uses: docker/build-push-action@v2
with:
push: true
tags: mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-arm64
file: docker/llvm-mos/Dockerfile.fix.arm64
context: .
platforms: arm64
build-args: |
LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}
TARGETARCH=arm64
build_image:
if: ${{ true }}
runs-on: ubuntu-latest
needs: []
# - amd64_image
# - arm64_image
steps:
- name: Set short sha
id: short_sha
run: |
echo "rust_mos=$(echo ${{ inputs.rust_mos_sha || github.sha }} | cut -b 1-8)" >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: show revisions
run: "echo llvm-mos: ${{ steps.short_sha.outputs.llvm_mos}} llvm-mos-sdk: ${{ steps.short_sha.outputs.llvm_mos_sdk}} rust_mos: ${{ steps.short_sha.outputs.rust_mos}}"
- name: cleanup
run: |
echo "=============================================================================="
echo "Freeing up disk space on CI system"
echo "=============================================================================="
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
echo "Removing large packages"
echo sudo apt-get update
echo sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'aspnetcore.*' 'temurin.*' azure-cli google-cloud-cli \
microsoft-edge-stable google-chrome-stable firefox powershell mono-devel \
'^gfortran.*' 'mono-devel' 'libllvm.*' 'mysql-server-core-.*' 'libclang-common.*' \
'^gcc-10.*' '^gcc-11.*' '^gcc-12.*' '^postgresql.*' 'libclang-cpp.*' '^.*-dev$'
echo sudo apt-get autoremove -y
echo sudo apt-get clean
df -h
echo "Removing large directories"
sudo rm -rf /usr/share/dotnet/ /usr/share/swift /usr/share/miniconda /usr/local/lib/android
df -h
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push rust-mos
id: build_rust_dist_image
uses: docker/build-push-action@v2
with:
push: true
tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos}}-dist
file: docker/rust-mos/Dockerfile
context: .
build-args: |
LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}
- name: Build and push multi-platform rust-mos image
id: build_rust_multiarch_image
uses: docker/build-push-action@v2
with:
push: true
tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos }}
file: docker/rust-mos/Dockerfile.multiarch
platforms: linux/amd64,linux/arm64
context: docker/rust-mos/
build-args: |
LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}
RUST_MOS_DIST_IMAGE=mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos }}-dist
test_image:
needs:
- build_image
uses: ./.github/workflows/aoc_tests.yml
with:
llvm_mos_ref: ${{inputs.llvm_mos_ref}}
llvm_mos_sdk_ref: ${{inputs.llvm_mos_sdk_ref}}
rust_mos_sha: ${{inputs.rust_mos_sha}}
secrets: inherit