-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (156 loc) · 6.6 KB
/
docker.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
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
name: Docker
on:
workflow_call:
jobs:
prebuild-diesel:
strategy:
matrix:
include:
- rust_arch: aarch64-unknown-linux-musl
docker_arch: arm64
- rust_arch: x86_64-unknown-linux-musl
docker_arch: amd64
runs-on: ubuntu-latest
steps:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203
with:
toolchain: stable
- name: Install development tools
uses: taiki-e/install-action@e26ea2a159162f8642fb555c0ed314d81e839c2d # v2.47.14
with:
tool: cargo-clone,cross
- name: Download and build diesel_cli
run: |
cargo clone diesel_cli
cd diesel_cli
cross build --release --target ${{ matrix.rust_arch }} --no-default-features --features "postgres-bundled, sqlite-bundled"
mv target/${{ matrix.rust_arch }}/release/diesel target/diesel.${{ matrix.docker_arch }}
- name: Upload artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: artifact-diesel-${{ matrix.rust_arch }}
path: diesel_cli/target/diesel.${{ matrix.docker_arch }}
if-no-files-found: error
prebuild-cargo-llvm-lines:
strategy:
matrix:
include:
- rust_arch: aarch64-unknown-linux-musl
docker_arch: arm64
- rust_arch: x86_64-unknown-linux-musl
docker_arch: amd64
runs-on: ubuntu-latest
steps:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203
with:
toolchain: stable
- name: Install development tools
uses: taiki-e/install-action@e26ea2a159162f8642fb555c0ed314d81e839c2d # v2.47.14
with:
tool: cargo-clone,cross
- name: Download and build cargo-llvm-lines
run: |
cargo clone cargo-llvm-lines
cd cargo-llvm-lines
cross build --release --target ${{ matrix.rust_arch }}
mv target/${{ matrix.rust_arch }}/release/cargo-llvm-lines target/cargo-llvm-lines.${{ matrix.docker_arch }}
- name: Upload artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: artifact-cargo-llvm-lines-${{ matrix.rust_arch }}
path: cargo-llvm-lines/target/cargo-llvm-lines.${{ matrix.docker_arch }}
if-no-files-found: error
build:
needs: [prebuild-diesel, prebuild-cargo-llvm-lines]
env:
node_version: "22"
strategy:
matrix:
include:
- version: stable
latest: false
- version: beta
latest: false
- version: nightly
latest: false
- version: "1.84"
latest: true
- version: "1.83"
latest: false
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download prebuild binaries
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: artifact-*
merge-multiple: true
- name: Build base image
uses: tweedegolf/build-container-image@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
# Rustup version extracted from docker images on https://github.com/rust-lang/docker-rust
# Cargo-binstall (non-full) version from https://github.com/cargo-bins/cargo-binstall/releases
# Sccache version from https://github.com/mozilla/sccache/releases
# Cargo-udeps version from https://github.com/est31/cargo-udeps/releases
# All packages use x86_64-unknown-linux-musl and aarch64-unknown-linux-musl
build-args: |
RUSTUP_VERSION=1.27.1
RUSTUP_SHA256_AMD64=6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d
RUSTUP_SHA256_ARM64=1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2
CARGO_BINSTALL_VERSION=1.8.0
CARGO_BINSTALL_SHA256_AMD64=8c771946367345f875634f72f10687f9fd737ac5e83cbbc2a132c1db0b3c508b
CARGO_BINSTALL_SHA256_ARM64=5f3c3d9cfe17fc225d2733b4ec82d002161c509cf7eb2415d2b01770bc68d0c3
SCCACHE_VERSION=0.8.1
SCCACHE_SHA256_AMD64=e0ee621fb16b6940666cd770b091c62cadafd3e062dd12e3a49d9caaff3b795f
SCCACHE_SHA256_ARM64=452cef732b24415493a7c6bca6e13536eb9464593fa87c753b6b7cb4733e9c50
CARGO_UDEPS_VERSION=0.1.49
CARGO_UDEPS_SHA256_AMD64=6560e6c3552aad9e0fc8f22e5da037dda9bf59679b24ac356e52ca3a39643cf9
CARGO_UDEPS_SHA256_ARM64=060fa3900ec5b6644351887b7fd649dcf89e425cb0926f704b24914474d760ce
RUST_VERSION=${{matrix.version}}
tags: |
ghcr.io/tweedegolf/rust-dev:${{matrix.version}}
${{ matrix.latest && 'ghcr.io/tweedegolf/rust-dev:latest' || '' }}
- name: Build node.js image variant
uses: tweedegolf/build-container-image@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
file: Dockerfile-node
build-args: |
RUST_VERSION=${{matrix.version}}
NODE_VERSION=${{env.node_version}}
tags: |
ghcr.io/tweedegolf/rust-dev:${{matrix.version}}-node
${{ matrix.latest && 'ghcr.io/tweedegolf/rust-dev:latest-node' || '' }}
- name: Build browser testing image variant
uses: tweedegolf/build-container-image@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
file: Dockerfile-browser
build-args: |
RUST_VERSION=${{matrix.version}}
tags: |
ghcr.io/tweedegolf/rust-dev:${{matrix.version}}-browser
${{ matrix.latest && 'ghcr.io/tweedegolf/rust-dev:latest-browser' || '' }}