holochain_scaffolding_cli 0.4000.4

CLI to easily generate and modify holochain apps
Documentation
name: "scaffolding-ci"

on:
  # Trigger the workflow on push or pull request,
  # but only for the main branch
  push:
    branches: [main, main-0.4]
  pull_request:
    branches: [main, main-0.4]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref_name }}
  cancel-in-progress: true

jobs:
  cargo_test:
    name: cargo_test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: 1.80.0
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --no-fail-fast

  rustfmt:
    name: rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: 1.80.0
          components: rustfmt
      - run: cargo fmt --all -- --check

  clippy:
    name: clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: 1.80.0
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy -- -D warnings

  nix_build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Maximize build space
        if: runner.os == 'Linux'
        uses: AdityaGarg8/remove-unwanted-software@v2
        with:
          remove-dotnet: "true"
          remove-android: "true"
          remove-codeql: "true"
          remove-docker-images: "true"

      - name: Install nix
        uses: cachix/install-nix-action@v30
        with:
          install_url: https://releases.nixos.org/nix/nix-2.24.4/install

      - uses: cachix/cachix-action@v15
        with:
          name: holochain-scaffolding-cli
          authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
          extraPullNames: holochain-ci

      - name: Build
        run: |
          cd $GITHUB_WORKSPACE
          nix develop --accept-flake-config .#ci --command echo 'test'

  testbuild:
    runs-on: ubuntu-latest
    needs: [nix_build]
    strategy:
      matrix:
        template: [svelte, vue, lit, react, vanilla]
    steps:
      - uses: actions/checkout@v4

      - name: Maximize build space
        if: runner.os == 'Linux'
        uses: AdityaGarg8/remove-unwanted-software@v2
        with:
          remove-dotnet: "true"
          remove-android: "true"
          remove-codeql: "true"
          remove-docker-images: "true"

      - name: Install nix
        uses: cachix/install-nix-action@v30
        with:
          install_url: https://releases.nixos.org/nix/nix-2.24.4/install

      - uses: cachix/cachix-action@v15
        with:
          name: holochain-scaffolding-cli
          authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
          extraPullNames: holochain-ci

      - name: Build and test
        run: |
          cd $GITHUB_WORKSPACE
          nix develop --accept-flake-config .#ci --command ./run_test.sh -t ${{ matrix.template }}

  testbuild_by_scope:
    runs-on: ubuntu-latest
    needs: [nix_build]
    strategy:
      matrix:
        scope:
          - hello_world
          - holo_integration
    steps:
      - uses: actions/checkout@v4

      - name: Maximize build space
        if: runner.os == 'Linux'
        uses: AdityaGarg8/remove-unwanted-software@v2
        with:
          remove-dotnet: "true"
          remove-android: "true"
          remove-codeql: "true"
          remove-docker-images: "true"

      - name: Install nix
        uses: cachix/install-nix-action@v30
        with:
          install_url: https://releases.nixos.org/nix/nix-2.24.4/install

      - uses: cachix/cachix-action@v15
        with:
          name: holochain-scaffolding-cli
          authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
          extraPullNames: holochain-ci

      - name: Build and test
        run: |
          cd $GITHUB_WORKSPACE
          nix develop --accept-flake-config .#ci --command ./run_test.sh -s ${{ matrix.scope }}

  ci_pass:
    if: ${{ always() }}
    runs-on: "ubuntu-latest"
    needs:
      - cargo_test
      - rustfmt
      - clippy
      - nix_build
      - testbuild
      - testbuild_by_scope
    steps:
      - name: check status
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}