diff --git a/.github/actions/free-disk-space/action.yml b/.github/actions/free-disk-space/action.yml new file mode 100644 index 00000000000..865ebfeb2c1 --- /dev/null +++ b/.github/actions/free-disk-space/action.yml @@ -0,0 +1,13 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +name: 'Free Disk Space' +description: 'Free up disk space on GitHub Actions runners' +runs: + using: 'composite' + steps: + - name: Free up disk space + shell: bash + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 4a9d9ed25cd..3bd16dd60c7 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -36,6 +36,7 @@ jobs: - uses: GitHubSecurityLab/actions-permissions/monitor@v1 - name: Checkout uses: actions/checkout@v4 + - uses: ./.github/actions/free-disk-space - name: Acquire credentials uses: aws-actions/configure-aws-credentials@v4 with: diff --git a/.github/workflows/ci-pr-forks.yml b/.github/workflows/ci-pr-forks.yml index 339c957daa9..056c2a238b5 100644 --- a/.github/workflows/ci-pr-forks.yml +++ b/.github/workflows/ci-pr-forks.yml @@ -34,6 +34,7 @@ jobs: - uses: actions/checkout@v4 with: path: smithy-rs + - uses: ./smithy-rs/.github/actions/free-disk-space - name: Acquire base image id: acquire env: diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 931cda09e00..25b9b546d42 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -69,6 +69,7 @@ jobs: - uses: actions/checkout@v4 with: path: smithy-rs + - uses: ./smithy-rs/.github/actions/free-disk-space - name: Acquire base image id: acquire env: diff --git a/tools/ci-build/.dockerignore b/tools/ci-build/.dockerignore new file mode 100644 index 00000000000..92d253085d3 --- /dev/null +++ b/tools/ci-build/.dockerignore @@ -0,0 +1,5 @@ +target/ +*.md +.github/ +design/ +examples/ diff --git a/tools/ci-build/Dockerfile b/tools/ci-build/Dockerfile index d867cc9fe03..5dcb1594e28 100644 --- a/tools/ci-build/Dockerfile +++ b/tools/ci-build/Dockerfile @@ -120,7 +120,8 @@ RUN cargo install --locked --path tools/ci-build/changelogger && \ cargo install --locked --path tools/ci-build/sdk-versioner && \ chmod g+rw -R /opt/cargo/registry && \ rm -rf /opt/cargo/registry/src && \ - rm -rf /opt/cargo/git/db + rm -rf /opt/cargo/git/db && \ + rm -rf /root/.cargo/registry/cache FROM install_rust AS cargo_tools ARG cargo_deny_version=0.16.4 @@ -149,7 +150,8 @@ RUN cargo install cargo-deny --locked --version ${cargo_deny_version} && \ cargo install mdbook --locked --version ${cargo_mdbook_version} && \ cargo install mdbook-mermaid --locked --version ${cargo_mdbook_mermaid_version} && \ rm -rf /opt/cargo/registry/src && \ - rm -rf /opt/cargo/git/db + rm -rf /opt/cargo/git/db && \ + rm -rf /root/.cargo/registry/cache # nodejs needed by internal release process FROM install_rust AS nodejs @@ -196,6 +198,7 @@ RUN set -eux; \ bc \ ca-certificates \ clang \ + cmake \ gcc \ git \ glibc-langpack-en \ @@ -209,7 +212,6 @@ RUN set -eux; \ python3-devel \ python3-pip \ shadow-utils \ - cmake \ tar \ unzip && \ yum clean all && \ @@ -226,19 +228,8 @@ RUN set -eux; \ COPY --chown=build:build --from=local_tools /opt/cargo /opt/cargo COPY --chown=build:build --from=gradle_wrapper /opt/gradle /home/build/.gradle -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-deny /opt/cargo/bin/cargo-deny -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-udeps /opt/cargo/bin/cargo-udeps -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-hack /opt/cargo/bin/cargo-hack -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-minimal-versions /opt/cargo/bin/cargo-minimal-versions -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-check-external-types /opt/cargo/bin/cargo-check-external-types -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/maturin /opt/cargo/bin/maturin -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/wasm-pack /opt/cargo/bin/wasm-pack -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/wasmtime /opt/cargo/bin/wasmtime -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-component /opt/cargo/bin/cargo-component +COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/ /opt/cargo/bin/ COPY --chown=build:build --from=install_rust /opt/rustup /opt/rustup -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/cargo-semver-checks /opt/cargo/bin/cargo-semver-checks -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/mdbook /opt/cargo/bin/mdbook -COPY --chown=build:build --from=cargo_tools /opt/cargo/bin/mdbook-mermaid /opt/cargo/bin/mdbook-mermaid COPY --chown=build:build --from=nodejs /opt/nodejs /opt/nodejs COPY --chown=build:build --from=musl_toolchain /usr/local/musl/ /usr/local/musl/ ENV PATH=/opt/nodejs/bin:/opt/cargo/bin:$PATH:/usr/local/musl/bin/ \