### Java Setup Action Configuration Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example configuration for the setup-java action using Blacksmith's caching infrastructure. ```yaml distribution: 'temurin' java-version: '21' ``` -------------------------------- ### Setup Java with Blacksmith Caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example configuration for the actions/setup-java action. When running on Blacksmith, the cache is automatically handled. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup java uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '21' ``` -------------------------------- ### Cleanup After Build Example Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks A YAML configuration example demonstrating how to set up a sticky disk for dependencies and enable cache cleanup. ```yaml name: Build with Cleanup on: push jobs: build: runs-on: blacksmith-4vcpu-ubuntu-2204 steps: - name: Create sticky disk for dependencies with: delete-docker-cache: true ``` -------------------------------- ### Configure Sticky Disks in GitHub Actions Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks Example of replacing standard setup actions with Blacksmith equivalents to enable persistent caching and sticky disks. ```yaml - uses: actions/checkout@v6 - name: Setup Node.js + uses: useblacksmith/setup-node@v5 with: node-version: '18.x' - name: Mount NPM Cache + uses: useblacksmith/stickydisk@v1 with: key: ``` -------------------------------- ### Caching with setup-go Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example configuration for using the setup-go action with Blacksmith's automatic caching. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup go uses: actions/setup-go@v6 with: go-version: '>=1.17.0' ``` -------------------------------- ### Configure setup-python caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example of enabling pip caching for the setup-python action. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup python uses: actions/setup-python@v6 with: python-version: '3.9' cache: 'pip' ``` -------------------------------- ### Configure Bazel with Blacksmith Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks Example configuration for setting up Bazel in a GitHub Actions workflow using the Blacksmith setup action. ```yaml - name: Setup Bazel uses: useblacksmith/setup-bazel@v2 with: version: '6.x' - name: Build run: | bazel build //... ``` -------------------------------- ### Caching with setup-node Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example configuration for using the setup-node action with Blacksmith's automatic caching. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup node uses: actions/setup-node@v6 with: ``` -------------------------------- ### Setup Go with Caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Configure the setup-go action to benefit from Blacksmith's caching layer. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup go uses: actions/setup-go@v5 ``` -------------------------------- ### Language-specific setup actions Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Standard setup actions for various languages that benefit from Blacksmith's colocated cache automatically. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup go uses: actions/setup-go@v6 with: go-version: '>=1.17.0' ``` ```yaml # If it's running on Blacksmith, it will use our cache name: Setup node uses: actions/setup-node@v6 with: node-version: 20 cache: 'npm' ``` ```yaml # If it's running on Blacksmith, it will use our cache name: Setup python uses: actions/setup-python@v6 with: python-version: '3.9' cache: 'pip' ``` ```yaml # If it's running on Blacksmith, it will use our cache name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.3' bundler-cache: true ``` ```yaml # If it's running on Blacksmith, it will use our cache name: Setup java uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '21' ``` -------------------------------- ### Java Setup with Blacksmith Caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Configures the actions/setup-java action to benefit from Blacksmith's automatic caching. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup java uses: actions/setup-java@v5 with: ``` -------------------------------- ### Multi-platform Build Matrix Strategy Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Example configuration for building multi-platform Docker images using a GitHub Actions matrix strategy. ```yaml jobs: build: runs-on: blacksmith-large strategy: matrix: platform: [linux/amd64, linux/arm64] steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Docker Buildx uses: blacksmith-sh/setup-docker-builder@v1 - name: Build and push uses: docker/build-push-action@v5 with: platforms: ${{ matrix.platform }} push: true tags: user/app:latest ``` -------------------------------- ### Configure Sticky Disks for Dependencies Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks Example YAML configuration for mounting node_modules and npm cache directories using the stickydisk action. ```yaml - name: Mount node_modules uses: useblacksmith/stickydisk@v1 with: key: ${{ github.repository }}-node-modules path: ./node_modules - name: Install Dependencies run: npm ci ``` -------------------------------- ### Update Runner Configuration Source: https://docs.blacksmith.sh/blacksmith-runners/overview Example showing how to switch from a standard ubuntu-latest runner to a Blacksmith-optimized runner in a YAML workflow file. ```yaml jobs: build: - runs-on: ubuntu-latest + runs-on: blacksmith-2vcpu-ubuntu-2404 ``` -------------------------------- ### Configure Docker Build Action Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Example configuration for a GitHub Actions workflow using the Blacksmith build-push-action with multi-arch support. ```yaml runs-on: blacksmith-8vcpu-ubuntu-2204 steps: ... - name: Build and push Docker image uses: useblacksmith/build-push-action@v2 with: platforms: linux/amd64,linux/arm64 ``` -------------------------------- ### Create and push annotated manifest Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds A YAML configuration example for creating and pushing a multi-platform Docker manifest using manual commands. ```yaml - name: Create and push annotated manifest run: | docker manifest create user/app:latest \ user/app:amd64 \ user/app:arm64 docker manifest annotate user/app:latest user/app:amd64 --arch amd64 docker manifest annotate user/app:latest user/app:arm64 --arch arm64 docker manifest push user/app:latest ``` -------------------------------- ### Configure Docker Build with Blacksmith Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Example YAML configuration for a GitHub Actions workflow using a Blacksmith runner and the build-push-action. ```yaml runs-on: blacksmith-8vcpu-ubuntu-2204 steps: ... - name: Build and push Docker image uses: useblacksmith/build-push-action@v2 with: platforms: linux/amd64,linux/arm64 ``` -------------------------------- ### Execute commands on a testbox Source: https://docs.blacksmith.sh/llms-full.txt Examples of running various test suites on a remote testbox using the blacksmith CLI. ```bash blacksmith testbox run --id tbx_01jkz5b3t9... "npm test" blacksmith testbox run --id tbx_01jkz5b3t9... "go test ./pkg/api/... -run TestHandler -v" blacksmith testbox run --id tbx_01jkz5b3t9... "cd backend && php artisan test --filter=HealthCheckTest" blacksmith testbox run --id tbx_01jkz5b3t9... "python -m pytest tests/test_api.py -k test_auth" ``` -------------------------------- ### Install sudo for Sticky Disk Permissions Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks Include this step in your workflow to ensure the environment has the necessary permissions to mount and format sticky disks. ```yaml steps: - name: Install sudo run: | apk add --no-cache sudo ``` -------------------------------- ### Ruby Setup with Blacksmith Caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Configures the ruby/setup-ruby action with bundler-cache enabled to utilize Blacksmith's caching layer. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.3' bundler-cache: true ``` -------------------------------- ### Setup Blacksmith Docker Builder Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Add the setup-docker-builder action to your workflow to enable layer caching when not using the default build-push-action. ```yaml uses: useblacksmith/setup-docker-builder@v1 # ... Docker commands in your workflow ... ``` -------------------------------- ### Connect to a Blacksmith Runner Source: https://docs.blacksmith.sh/blacksmith-observability/ssh-access Use the SSH command provided in the 'Setup runner' step of your workflow logs to connect to the active VM. ```bash ssh -p 12345 runner@... ``` -------------------------------- ### Install the Blacksmith CLI Source: https://docs.blacksmith.sh/llms-full.txt Installs the Blacksmith CLI tool. The CLI automatically updates itself on every invocation. ```bash curl -fsSL https://get.blacksmith.sh | sh ``` -------------------------------- ### Install Sudo in Container Source: https://docs.blacksmith.sh/llms-full.txt Installs sudo in a container image to ensure proper permissions for mounting and formatting sticky disks. ```yaml steps: - name: Install sudo run: | apk add --no-cache sudo ``` -------------------------------- ### Query Syntax Example Source: https://docs.blacksmith.sh/blacksmith-observability/logs A complex query combining branch, severity level, and exclusion filters. ```text branch:main level:error,warn failed -"econn refused" ``` -------------------------------- ### Initialize Theme Script Source: https://app.blacksmith.sh/settings Handles theme switching between light and dark modes based on local storage or system preferences. ```javascript !function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');var e=localStorage.getItem('theme');if('system'===e||(!e&&true)){var t='(prefers-color-scheme: dark)',m=window.matchMedia(t);if(m.media!==t||m.matches){d.style.colorScheme = 'dark';c.add('dark')}else{d.style.colorScheme = 'light';c.add('light')}}else if(e){c.add(e|| '')}if(e==='light'||e==='dark')d.style.colorScheme=e}catch(e){}}() ``` -------------------------------- ### Initialize Testbox Workflow Source: https://docs.blacksmith.sh/llms-full.txt Scans the repository to generate a testbox-compatible workflow file and agent skill. Requires authentication via browser if not already logged in. ```bash blacksmith testbox init ``` -------------------------------- ### Setup Blacksmith Docker Builder Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Configure a Blacksmith builder in your workflow when not using the standard docker/build-push-action. ```yaml uses: useblacksmith/setup-docker-builder@v1 # ... Docker commands in your workflow ... ``` -------------------------------- ### Configure setup-node with Blacksmith caching Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Use the standard setup-node action; Blacksmith will automatically handle the caching of npm dependencies. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup node uses: actions/setup-node@v6 with: node-version: 20 cache: 'npm' ``` -------------------------------- ### Save cache with actions/cache/save Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example of using the actions/cache/save@v5 action to persist specific paths in the cache. ```yaml # If it's running on Blacksmith, it will use our cache name: Save cache uses: actions/cache/save@v5 with: path: node_modules key: ${{ ``` -------------------------------- ### Enable Caching for setup-ruby Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Configure the setup-ruby action to utilize Blacksmith's caching mechanism. ```yaml # If it's running on Blacksmith, it will use our cache name: Setup ruby uses: ruby/setup-ruby@v1 with: ``` -------------------------------- ### Configure Sticky Disks in GitHub Actions Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-sticky-disks Example configuration for enabling Blacksmith runners in a GitHub Actions workflow. ```yaml jobs: build: runs-on: blacksmith steps: ``` -------------------------------- ### Cache Cargo dependencies with actions/cache Source: https://docs.blacksmith.sh/blacksmith-caching/dependencies-actions Example of using the standard actions/cache@v5 action which Blacksmith will automatically optimize. ```yaml # If it's running on Blacksmith, it will use our cache name: Cache Cargo dependencies uses: actions/cache@v5 ``` -------------------------------- ### Multi-platform build matrix configuration Source: https://docs.blacksmith.sh/blacksmith-caching/docker-builds Example of using a GitHub Actions matrix strategy to build multi-platform Docker images on Blacksmith runners. ```yaml jobs: build: strategy: matrix: platform: [linux/amd64, linux/arm64] runs-on: blacksmith-large-${{ matrix.platform }} steps: - uses: actions/checkout@v4 - uses: blacksmith-sh/setup-docker-builder@v1 - uses: docker/build-push-action@v5 with: platforms: ${{ matrix.platform }} push: true tags: my-image:latest ```