Skip to content

Android-KitKat/rust-action-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Action Builder

GitHub Stars Docker Stars

Docker Image Version Docker Image Size Docker Image Pulls

Rust builder for Action on Linux.

Can be used for self-hosted runners on Linux.

Environments

Supported targets

Windows

  • x86_64-pc-windows-gnullvm
  • aarch64-pc-windows-gnullvm

Linux

  • x86_64-unknown-linux-musl
  • x86_64-unknown-linux-gnu
  • aarch64-unknown-linux-musl
  • aarch64-unknown-linux-gnu
  • armv7-unknown-linux-musleabihf

macOS

  • x86_64-apple-darwin
  • aarch64-apple-darwin

Example

Just specify jobs.<job_id>.container.image as android99/rust-action-builder.

name: Build

on:
  push:
    branches: [main]
  workflow_dispatch: {}

jobs:
  build:
    name: Build ${{ matrix.os }} Platform
    runs-on: ubuntu-latest
    container:
      image: android99/rust-action-builder
    env:
      TARGET: ${{ matrix.target }}
      BINARY: ${{ matrix.binary }}

    strategy:
      matrix:
        fail-fast: false
        include:
          - os: Windows
            target: x86_64-pc-windows-gnullvm
            binary: app.exe
            artifact: app-windows-x86_64

          - os: Linux
            target: x86_64-unknown-linux-musl
            binary: app
            artifact: app-linux-x86_64

          - os: macOS
            target: universal-apple-darwin
            binary: app
            artifact: app-macos-universal

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2

      - name: Build Binary
        run: |
          if [ "$TARGET" = universal-apple-darwin ]; then
            cargo build -r --target x86_64-apple-darwin --target aarch64-apple-darwin
            mkdir -p "target/$TARGET/release"
            lipo -create \
              "target/x86_64-apple-darwin/release/$BINARY" \
              "target/aarch64-apple-darwin/release/$BINARY" \
              -output "target/$TARGET/release/$BINARY"
          else
            cargo build -r --target "$TARGET"
          fi

      - name: Upload Artifact
        uses: actions/upload-artifact@v7
        with:
          name: ${{ matrix.artifact }}
          path: target/${{ matrix.target }}/release/${{ matrix.binary }}
          if-no-files-found: error

Acknowledgements

About

Rust builder for Action on Linux. Can be used for self-hosted runners on Linux.

Topics

Resources

License

Stars

Watchers

Forks

Contributors