From ca553127c36803b8215b9024b37e361a4647b832 Mon Sep 17 00:00:00 2001 From: Seth Junot Date: Mon, 23 Oct 2023 23:11:20 -0700 Subject: [PATCH] Add GitHub workflow to run a simple cargo build (#2) Runs `cargo build` on all pushes and pull requests. Note that command run at the root of the repo, isn't sufficient to build the ROM artifact; see the README. --- .github/workflows/rust.yml | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..d4de1b0 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,65 @@ +name: Debug build that doesn't produce a ROM + +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + LLVM_VERSION: 16.0.4 + +jobs: + build: + strategy: + fail-fast: true + matrix: + include: + + - os: ubuntu-latest + llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-22.04.tar.xz + + # No pre-built binaries for amd64 macOS :< + # + # - os: macos-latest + # llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-arm64-apple-darwin22.0.tar.xz + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Cache pre-built binaries of LLVM + id: cache-llvm + uses: actions/cache@v2 + with: + path: | + llvm/bin/lld + llvm/bin/ld.lld + key: llvm-${{ env.LLVM_VERSION }}-${{ matrix.os }} + + - name: Cache of Cargo registry and build artifacts + id: cache-rust + uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + target + key: rust-${{ env.LLVM_VERSION }}-${{ matrix.os }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock', 'rust-toolchain.toml', '**/config.toml') }} + + - name: Download and extract pre-built LLVM release + if: steps.cache-llvm.outputs.cache-hit != 'true' + run: | + mkdir -p llvm + curl -L ${{ matrix.llvm_url }} | tar xJ --strip-components=1 -C llvm + + - name: Add extracted LLVM binaries to PATH + run: echo "$GITHUB_WORKSPACE/llvm/bin" >> $GITHUB_PATH + + - name: Debug build of Raku from repo root + run: cargo build