Skip to content

Commit

Permalink
build release outside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ggera committed Aug 20, 2024
1 parent 5e9fc82 commit afec45a
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 62 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:

- name: Build Docker Images
run: |
./.maintain/build-image.sh build
cargo build --locked --release --features default
docker build -t kilt-node .
- name: Push Image - Commit SHA
if: github.ref_type == 'branch'
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/cargo-clippy.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/check-clippy-all-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Check Clippy all-features

on:
pull_request:

jobs:
get-head-commit-msg:
runs-on: ubuntu-latest
outputs:
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

check-clippy-all-features:
runs-on: ubuntu-latest
needs: get-head-commit-msg
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: $ ${{ github.job }}-${{ github.ref }}-clippy-all-features-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
$ ${{ github.job }}-${{ github.ref }}-clippy-all-features-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run Clippy
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "
cargo clippy --all-targets --all-features --locked --quiet && \
chown -R $(id -u):$(id -g) target/"
59 changes: 59 additions & 0 deletions .github/workflows/check-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Check Clippy

on:
pull_request:

jobs:
get-head-commit-msg:
runs-on: ubuntu-latest
outputs:
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

check-clippy:
runs-on: ubuntu-latest
needs: get-head-commit-msg
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
$ ${{ github.job }}-${{ github.ref }}-clippy-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run Clippy
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "
cargo clippy --all-targets --locked --quiet && \
chown -R $(id -u):$(id -g) target/"
59 changes: 59 additions & 0 deletions .github/workflows/check-rustdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Cargo Clippy

on:
pull_request:

jobs:
get-head-commit-msg:
runs-on: ubuntu-latest
outputs:
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

check-clippy:
runs-on: ubuntu-latest
needs: get-head-commit-msg
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: $ ${{ github.job }}-${{ github.ref }}-rustdoc-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
$ ${{ github.job }}-${{ github.ref }}-rustdoc-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run doc
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "
cargo doc --all-features --no-deps --locked && \
chown -R $(id -u):$(id -g) target/"
59 changes: 59 additions & 0 deletions .github/workflows/test-all-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Check Clippy

on:
pull_request:

jobs:
get-head-commit-msg:
runs-on: ubuntu-latest
outputs:
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

check-clippy:
runs-on: ubuntu-latest
needs: get-head-commit-msg
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
$ ${{ github.job }}-${{ github.ref }}-clippy-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run Clippy
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "
cargo test --all-features --all-targets --locked && \
chown -R $(id -u):$(id -g) target/"
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Check Clippy

on:
pull_request:

jobs:
get-head-commit-msg:
runs-on: ubuntu-latest
outputs:
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

check-clippy:
runs-on: ubuntu-latest
needs: get-head-commit-msg
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
$ ${{ github.job }}-${{ github.ref }}-clippy-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run Clippy
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "
cargo test --all-targets --locked && \
chown -R $(id -u):$(id -g) target/"
17 changes: 1 addition & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# this container builds the kilt-parachain binary from source files and the runtime library
# pinned the version to avoid build cache invalidation

FROM paritytech/ci-unified:bullseye-1.70.0 as builder

WORKDIR /build

ARG FEATURES=default

COPY . .

RUN cargo build --locked --release --features $FEATURES

# ===== SECOND STAGE ======

FROM docker.io/library/ubuntu:20.04
LABEL description="This is the 2nd stage: a very small image where we copy the kilt-parachain binary."

ARG NODE_TYPE=kilt-parachain

COPY --from=builder /build/target/release/$NODE_TYPE /usr/local/bin/node-executable
COPY ./target/release/$NODE_TYPE /usr/local/bin/node-executable

RUN useradd -m -u 1000 -U -s /bin/sh -d /node node && \
mkdir -p /node/.local/share/node && \
Expand Down

0 comments on commit afec45a

Please sign in to comment.