Skip to content

Commit 422af79

Browse files
committed
Simplify build-ami to reuse existing actions
Signed-off-by: Claude <[email protected]>
1 parent 0fb9d91 commit 422af79

File tree

1 file changed

+8
-110
lines changed

1 file changed

+8
-110
lines changed

.github/actions/build-ami/action.yml

Lines changed: 8 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ inputs:
1717
description: "Number of days before AMI is deprecated"
1818
required: false
1919
default: "30"
20-
rust-toolchain:
21-
description: "Rust toolchain version (reads from rust-toolchain.toml if empty)"
22-
required: false
23-
default: ""
24-
protoc-version:
25-
description: "Protocol Buffers compiler version"
26-
required: false
27-
default: "29.3"
28-
flatc-version:
29-
description: "FlatBuffers compiler version"
30-
required: false
31-
default: "25.9.23"
3220

3321
outputs:
3422
ami-id:
@@ -41,126 +29,36 @@ outputs:
4129
runs:
4230
using: "composite"
4331
steps:
44-
- name: Resolve Rust Toolchain
45-
id: toolchain
46-
shell: bash
47-
run: |
48-
if [ -n "${{ inputs.rust-toolchain }}" ]; then
49-
echo "version=${{ inputs.rust-toolchain }}" >> $GITHUB_OUTPUT
50-
elif [ -f rust-toolchain.toml ]; then
51-
VERSION=$(grep channel rust-toolchain.toml | awk -F'"' '{print $2}')
52-
echo "version=$VERSION" >> $GITHUB_OUTPUT
53-
else
54-
echo "version=stable" >> $GITHUB_OUTPUT
55-
fi
32+
- name: Setup Rust
33+
uses: ./.github/actions/setup-rust
34+
35+
- name: Setup flatc
36+
uses: ./.github/actions/setup-flatc
5637

57-
- name: Install dependencies
38+
- name: Install extra dependencies
5839
shell: bash
5940
run: |
6041
sudo apt-get update
6142
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
62-
build-essential \
63-
curl \
64-
git \
65-
ca-certificates \
66-
pkg-config \
67-
libssl-dev \
6843
cmake \
6944
ninja-build \
7045
clang \
7146
lld \
72-
llvm \
73-
jq \
74-
unzip \
75-
zip \
76-
zstd \
77-
python3 \
78-
python3-pip \
79-
python3-venv \
80-
libicu74 \
81-
libkrb5-3 \
82-
zlib1g \
83-
libcurl4-openssl-dev
47+
llvm
8448
85-
- name: Install mold linker
49+
- name: Install nightly toolchain
8650
shell: bash
8751
run: |
88-
MOLD_VERSION=$(curl -s https://api.github.com/repos/rui314/mold/releases/latest | jq -r .tag_name | sed 's/v//')
89-
ARCH=$(uname -m)
90-
curl -fsSL "https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-${ARCH}-linux.tar.gz" \
91-
| sudo tar -xz -C /usr/local --strip-components=1
92-
mold --version
93-
94-
- name: Install Rust
95-
shell: bash
96-
env:
97-
RUST_TOOLCHAIN: ${{ steps.toolchain.outputs.version }}
98-
run: |
99-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN"
100-
source "$HOME/.cargo/env"
101-
rustup component add clippy rustfmt
10252
rustup toolchain install nightly
10353
rustup component add --toolchain nightly rustfmt clippy rust-src miri llvm-tools-preview
104-
cargo --version
105-
rustc --version
106-
107-
- name: Install protoc
108-
shell: bash
109-
env:
110-
PROTOC_VERSION: ${{ inputs.protoc-version }}
111-
run: |
112-
ARCH=$(uname -m)
113-
if [ "$ARCH" = "x86_64" ]; then PROTOC_ARCH=linux-x86_64; else PROTOC_ARCH=linux-aarch_64; fi
114-
curl -fsSL -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_ARCH}.zip"
115-
sudo unzip -o /tmp/protoc.zip -d /usr/local bin/protoc 'include/*'
116-
sudo chmod +x /usr/local/bin/protoc
117-
rm /tmp/protoc.zip
118-
protoc --version
119-
120-
- name: Install flatc
121-
shell: bash
122-
env:
123-
FLATC_VERSION: ${{ inputs.flatc-version }}
124-
run: |
125-
ARCH=$(uname -m)
126-
if [ "$ARCH" = "x86_64" ]; then
127-
curl -fsSL -o /tmp/flatc.zip "https://github.com/nicholasguan/flatbuffers/releases/download/v${FLATC_VERSION}/Linux.flatc.binary.clang++-18.zip"
128-
sudo unzip -o /tmp/flatc.zip -d /usr/local/bin
129-
sudo chmod +x /usr/local/bin/flatc
130-
rm /tmp/flatc.zip
131-
else
132-
git clone --depth 1 --branch "v${FLATC_VERSION}" https://github.com/google/flatbuffers.git /tmp/flatbuffers
133-
cd /tmp/flatbuffers && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja
134-
sudo cp flatc /usr/local/bin/
135-
rm -rf /tmp/flatbuffers
136-
fi
137-
flatc --version
138-
139-
- name: Install sccache
140-
shell: bash
141-
run: |
142-
SCCACHE_VERSION=$(curl -s https://api.github.com/repos/mozilla/sccache/releases/latest | jq -r .tag_name | sed 's/v//')
143-
ARCH=$(uname -m)
144-
if [ "$ARCH" = "x86_64" ]; then SCCACHE_ARCH=x86_64-unknown-linux-musl; else SCCACHE_ARCH=aarch64-unknown-linux-musl; fi
145-
curl -fsSL "https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}.tar.gz" \
146-
| sudo tar -xz -C /usr/local/bin --strip-components=1 "sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}/sccache"
147-
sudo chmod +x /usr/local/bin/sccache
148-
sccache --version
14954
15055
- name: Install cargo tools
15156
shell: bash
15257
run: |
153-
source "$HOME/.cargo/env"
15458
cargo install cargo-nextest --locked
15559
cargo install cargo-hack --locked
15660
cargo install grcov --locked
15761
158-
- name: Setup environment
159-
shell: bash
160-
run: |
161-
echo 'source $HOME/.cargo/env' >> "$HOME/.bashrc"
162-
echo 'export PATH=$HOME/.cargo/bin:/usr/local/bin:$PATH' >> "$HOME/.bashrc"
163-
16462
- name: Get instance ID
16563
id: instance
16664
shell: bash

0 commit comments

Comments
 (0)