livebud / bud

The Full-Stack Web Framework for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Bud's project with GitHub Actions isn't working

Fuerback opened this issue · comments

Hey, I'm trying to create a GitHub Action workflow to build the project, but I couldn't find a way to make it work.

I don't know if the installation sh file can be changed to allow GH Actions to install Bud, for example.

Build workflow

name: Build
on: push
jobs:
build:
  name: Build
  runs-on: ubuntu-latest
  steps:
    - uses: actions/setup-go@v3
      with:
        go-version: 1.19
    - uses: actions/checkout@v3
    - name: Install nodejs and npm
      run: |
        sudo apt update
        sudo apt install nodejs
        sudo apt install npm
    - name: Given permission to install Bud
      run: sudo chown -R $USER:$USER ${{ github.workspace }}
    - name: Install Bud
      run: sudo curl -sf https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh
    - name: Build project
      run: bud build

Error

Screenshot from 2022-11-15 11-03-02

Update

I could find a way to make it work, here is what I did:

The new build workflow is:

Build workflow

name: Build
on: push
jobs:
build:
  name: Build
  runs-on: ubuntu-latest
  steps:
    - uses: actions/setup-go@v3
      with:
        go-version: 1.19
    - uses: actions/checkout@v3
    - name: Setup Node.js
      uses: actions/setup-node@v3
      with:
        cache: 'npm'
        cache-dependency-path: |
          livebud/package-lock.json
          package-lock.json
    - name: Install Bud
      run: |
        chmod +x ./bud-install.sh
        ./bud-install.sh
      shell: bash
    - name: Run npm
      run: npm install
    - name: Bud build
      run: sudo bud build

But I'm still having problems when executing bud build command:

| app: unable to load state: app: unable to wire. di: unable to wire "github.com/roarstudiosinc/build-tracker/bud/program".loadWeb function. di: unable to find definition for param "github.com/livebud/bud/package/router".*Router in "github.com/roarstudiosinc/build-tracker/bud/internal/app/web".*Server . parser: unable to find declaration for "github.com/livebud/bud/package/router".Router in "bud/internal/app/web/web.go". stat /root/go/pkg/mod/github.com/livebud/bud@v0.2.5: no such file or directory
Error: Process completed with exit code 1.

Screenshot from 2022-11-15 13-45-20

All the problems above were fixed with following workflow:

name: Build
on: push
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v3
        with:
          go-version: 1.19
      - uses: actions/checkout@v3
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          cache: 'npm'
          cache-dependency-path: |
            livebud/package-lock.json
            package-lock.json
      - name: Install Bud
        run: |
          chmod +x ./bud-install.sh
          ./bud-install.sh
        shell: bash
      - name: Run npm
        run: npm install
      - name: Install Go modules
        run: go mod download
      - name: Bud build
        run: bud build

What is different from the last one is the Install Go modules step.