Skip to content

Commit

Permalink
Update rust.yml workflow action to save used space in github
Browse files Browse the repository at this point in the history
The main changes in this updated workflow are:
The use of the rust:1.70-slim-bullseye image

Merging of jobs: We have merged the build and release jobs into a single build_and_release job to optimize execution.
Extended clean-up process: The clean-up step has been extended to remove more temporary files and directories:

rm -rf ~/.cargo/registry: Removes downloaded crates.
rm -rf ~/.cargo/git: Removes cloned repositories.
df -h: Shows the available disk space, which can help diagnose storage problems.

The if: always() condition ensures that the clean-up step is also executed if previous steps have failed.

These changes should help to minimize memory consumption within the container
  • Loading branch information
NxtTAB committed Jul 25, 2024
1 parent c583693 commit 2c53ca9
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,30 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
build_and_release:

runs-on: ubuntu-latest

container:
image: rust:1.70-slim7-bullseye

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run tests
run: cargo test --verbose

release:

needs: build

runs-on: ubuntu-latest
- name: Build Release
run: cargo build --release --verbose

steps:
- uses: actions/checkout@v2

- name: Release_linux_x64 and Copy to assets
- name: Prepare Release Asset
run: |
cargo build --release --verbose
mkdir -p assets/bin/linux_x64
cp target/release/wami assets/bin/linux_x64/wami
chmod +x assets/bin/linux_x64/wami
- name: Create Release Linux x64
id: create_release
uses: softprops/action-gh-release@v1
- name: Create Releass
uses: softprops/actions-gh-release@1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -46,3 +42,13 @@ jobs:
body: This is the new release of the Linux x64 wami binary file
draft: false
prerelease: false

- name: Clean up
if: always()
run: |
rm -rf assets
rm -rf target
cargo clean
rm -rf ~/.cargo/registry
rm -rf ~/.cargo/git
df -h # Displays the available storage space

0 comments on commit 2c53ca9

Please sign in to comment.