Skip to content

Commit 5e61788

Browse files
committed
Simplify package and add new GHA workflows
1 parent b8e9496 commit 5e61788

File tree

3 files changed

+98
-44
lines changed

3 files changed

+98
-44
lines changed

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- os: ubuntu-latest
14+
triple: x86_64-unknown-linux-gnu
15+
# - os: macos-14
16+
# triple: aarch64-apple-darwin
17+
# - os: macos-13
18+
# triple: x86_64-apple-darwin
19+
# - os: buildjet-32vcpu-ubuntu-2004
20+
# triple: x86_64-unknown-linux-gnu
21+
# - os: buildjet-32vcpu-ubuntu-2204-arm
22+
# triple: aarch64-unknown-linux-gnu
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- name: Install nightly toolchain
26+
id: rustc-toolchain
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: nightly-2024-01-25
30+
default: true
31+
32+
- uses: lukka/get-cmake@v3.27.4
33+
34+
- name: Show rust version
35+
run: |
36+
cargo version
37+
rustup toolchain list
38+
39+
- name: Check out succinctlabs/rust
40+
uses: actions/checkout@v3
41+
with:
42+
repository: succinctlabs/rust
43+
path: rust
44+
fetch-depth: 0
45+
46+
- name: Check out athenavm/athena
47+
uses: actions/checkout@v3
48+
with:
49+
repository: athenavm/athena
50+
ref: main
51+
path: athena
52+
53+
- name: Build
54+
run: GITHUB_ACTIONS=false ATHENA_BUILD_DIR=$GITHUB_WORKSPACE cargo run --bin cargo-athena -- athena build-toolchain
55+
working-directory: athena
56+
57+
- name: Archive build output
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: rust-toolchain-${{ matrix.triple }}
61+
path: |
62+
athena/rust-toolchain-${{ matrix.triple }}.tar.gz

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
7+
jobs:
8+
build:
9+
uses: ./.github/workflows/ci.yml
10+
11+
release:
12+
needs: build
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Download artifacts
18+
uses: actions/download-artifact@v3
19+
with:
20+
path: artifacts
21+
- name: Create release
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
echo "Installing gh CLI..."
26+
curl -L https://github.com/cli/cli/releases/download/v2.17.0/gh_2.17.0_linux_amd64.tar.gz | \
27+
tar xvz --strip-components=2 --exclude=man
28+
chmod +x ./gh
29+
mkdir tars
30+
mv ./artifacts/*/*.tar.gz tars/
31+
32+
./gh release create --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./tars/* || \
33+
./gh release upload --repo "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" ./tars/*

package.sh

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,6 @@ set -euo pipefail
44

55
source config.sh
66

7-
# We generally remove files as soon as we don't need them
8-
# anymore to minimize disk space usage. Especially important for github runners
9-
# which don't have much space.
10-
11-
inst () {
12-
echo "Installing: $1"
13-
tar -xf ../$1.tar.gz
14-
# eager remove to reduce max disk space used
15-
rm ../$1.tar.gz
16-
cd $1
17-
./install.sh --disable-ldconfig --prefix="" --destdir="/tmp/$TOOLCHAIN_NAME"
18-
cd ../
19-
}
20-
21-
# dist contains the tared components we want to install
22-
mv rust/build/dist .
23-
#rm -rf rust
24-
25-
cd dist
26-
mkdir unpack
27-
cd unpack
28-
29-
inst "rustc-nightly-$TOOLCHAIN_HOST_TRIPLET"
30-
inst "rust-std-nightly-$TOOLCHAIN_HOST_TRIPLET"
31-
inst "rust-std-nightly-riscv32em-athena-zkvm-elf"
32-
inst "cargo-nightly-$TOOLCHAIN_HOST_TRIPLET"
33-
inst "rust-src-nightly"
34-
inst "rustfmt-nightly-$TOOLCHAIN_HOST_TRIPLET"
35-
inst "clippy-nightly-$TOOLCHAIN_HOST_TRIPLET"
36-
37-
cd ..
38-
rm -rf unpack
39-
40-
cd ../
41-
42-
# remove the /tmp/ prefix from the manifest to make it path independent
43-
sed -i'' -e "s#/tmp/$TOOLCHAIN_NAME/##g" /tmp/$TOOLCHAIN_NAME/lib/rustlib/manifest-*
44-
rm -f /tmp/$TOOLCHAIN_NAME/lib/rustlib/install.log
45-
46-
# the final toolchain tar that can just be extracted anywhere to install it
47-
tar --zstd -cf $ARTIFACT_NAME.tar.zst -C /tmp $TOOLCHAIN_NAME
48-
49-
rm -rf dist
50-
rm -rf /tmp/$TOOLCHAIN_NAME
7+
TOOLCHAIN_DIR=rust/build/$TOOLCHAIN_HOST_TRIPLET/stage2
8+
cp -n rust/build/$TOOLCHAIN_HOST_TRIPLET/stage2-tools-bin/* $TOOLCHAIN_DIR/bin
9+
tar --exclude lib/rustlib/src --exclude lib/rustlib/rustc-src -hczvf rust-toolchain-$TOOLCHAIN_NAME.tar.gz -C $TOOLCHAIN_DIR .

0 commit comments

Comments
 (0)