Skip to content

Commit

Permalink
fix(ci): env var cleanup, wget aarch64 musl, fetch depth 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gluax committed Oct 11, 2024
1 parent e050368 commit e9068c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
required: true
architecture:
required: true
description: 'The architecture to build for'
description: "The architecture to build for"
type: choice
options:
- all
Expand All @@ -17,7 +17,7 @@ on:
- static-x86-64
debug:
required: false
description: 'Enable debug mode'
description: "Enable debug mode"
type: boolean
default: false

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- name: 🫙 Cache
uses: Swatinem/rust-cache@v2
Expand All @@ -73,13 +73,13 @@ jobs:
cargo xtask compile ${{ github.event.inputs.architecture }} --debug
- name: 🔨 Build Library For ${{ github.event.inputs.architecture }}
if: ${{ github.event.inputs.debug == 'false' }}
if: ${{ github.event.inputs.debug == 'false' }}
run: |
cargo xtask compile ${{ github.event.inputs.architecture }}
- name: 📝 Set Branch Name
id: set_branch
run: echo "FORMATTED_REF=${{ github.ref }}" | sed 's/\//-/g' >> $GITHUB_OUTPUT
run: echo "FORMATTED_REF=${{ github.ref }}" | sed 's/\//-/g' >> $GITHUB_OUTPUT

- name: 📤 Upload Artifacts
uses: actions/upload-artifact@v4
Expand Down
12 changes: 12 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ struct AptInstall {
}

impl AptInstall {
fn install_aarch64_musl_gcc(sh: &Shell) -> Result<()> {
cmd!(sh, "wget https://musl.cc/aarch64-linux-musl-cross.tgz").run()?;
cmd!(sh, "tar -xvf aarch64-linux-musl-cross.tgz").run()?;
cmd!(sh, "sudo mv aarch64-linux-musl-cross /opt").run()?;
Ok(())
}

fn handle(self, sh: &Shell) -> Result<()> {
match self.arch {
Arch::All => {
Self::install_aarch64_musl_gcc(sh)?;
cmd!(
sh,
"sudo apt-get install -y clang llvm gcc-aarch64-linux-gnu qemu-user-static musl-tools"
Expand All @@ -77,6 +85,7 @@ impl AptInstall {
cmd!(sh, "sudo apt-get install -y clang llvm").run()?;
}
Arch::StaticAarch64 => {
Self::install_aarch64_musl_gcc(sh)?;
cmd!(sh, "sudo apt-get install -y musl-tools").run()?;
}
Arch::StaticX86_64 => {
Expand All @@ -100,6 +109,7 @@ struct Compile {
debug: bool,
arch: Arch,
}

impl Compile {
fn handle(self, sh: &Shell) -> Result<()> {
if let Arch::All = self.arch {
Expand Down Expand Up @@ -159,6 +169,8 @@ impl Compile {
target_dir.join(target).join(path).join(arch.filename()),
target_dir.join(rename),
)?;
std::env::remove_var("CC");
std::env::remove_var("CXX");
Ok(())
}
}
Expand Down

0 comments on commit e9068c4

Please sign in to comment.