Skip to content

Commit

Permalink
Fix homebrew (#360)
Browse files Browse the repository at this point in the history
* feat: upgrade release action

* fix: downgrade docker/setup-buildx-action to v3

* fix: update reviewers on release PR

* fix:comment failing packages on Windows
  • Loading branch information
stdevMac authored Feb 14, 2024
1 parent 5805758 commit e303442
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 116 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ jobs:
VERSION: ${{ github.event.inputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.19.0"

- run: chmod +x ./scripts/build-go-darwin-binaries.sh && ./scripts/build-go-darwin-binaries.sh

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
name: Uploading sedge darwin amd64 package
with:
name: sedge-${{env.VERSION}}-darwin-amd64
path: build/sedge-${{env.VERSION}}-darwin-amd64

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
name: Uploading sedge darwin arm64 package
with:
name: sedge-${{env.VERSION}}-darwin-arm64
Expand All @@ -48,15 +48,15 @@ jobs:
needs: sedge-darwin
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21.0"

- run: scripts\build-go-windows-binaries.ps1

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
name: Uploading sedge windows amd64 package
with:
name: sedge-${{env.VERSION}}-windows-amd64.exe
Expand All @@ -70,28 +70,28 @@ jobs:
needs: sedge-windows
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.19.0"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- run: chmod +x ./scripts/build-go-linux-binaries.sh && ./scripts/build-go-linux-binaries.sh

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
name: Uploading sedge linux amd64 package
with:
name: sedge-${{env.VERSION}}-linux-amd64
path: build/sedge-${{env.VERSION}}-linux-amd64

- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v4
name: Uploading sedge linux arm64 package
with:
name: sedge-${{env.VERSION}}-linux-arm64
Expand All @@ -105,12 +105,12 @@ jobs:
needs: sedge-linux
steps:
- name: Download packages
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: /tmp/binaries

- name: Checkout repository
uses: actions/checkout@master
uses: actions/checkout@v4
with:
repository: NethermindEth/homebrew-sedge
path: homebrew-sedge
Expand All @@ -126,7 +126,7 @@ jobs:
token: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }}
commit-message: Update Homebrew to latest release
title: "[Release] Update Homebrew"
reviewers: falcoxyz, AntiD2ta, cbermudez97, stdevMac
reviewers: AntiD2ta, cbermudez97, stdevMac, adriantpaez
draft: false
path: homebrew-sedge
add-paths: |
Expand All @@ -140,10 +140,10 @@ jobs:
needs: update-homebrew
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download packages
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: /tmp/binaries
- name: Generate Changelog
Expand Down Expand Up @@ -184,10 +184,10 @@ jobs:
run: |
sudo apt update && sudo apt install golang-go debhelper libdebhelper-perl build-essential devscripts rsync -y
- name: Checking out Sedge repository
uses: actions/checkout@master
uses: actions/checkout@v4
with:
path: sedge
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: "1.19.0"
- name: Run publish PPA script
Expand All @@ -200,7 +200,7 @@ jobs:
- name: Sleep for 1 hour
run: sleep 3600s
shell: bash
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
- run: pip install launchpadlib --upgrade
- name: Run copy binaries PPA script
env:
Expand Down
186 changes: 91 additions & 95 deletions internal/pkg/commands/commands_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,99 +18,95 @@ limitations under the License.
*/
package commands

import (
"fmt"
"testing"
"text/template"
)
// FIXME Test not working on pipeline
//func TestRunCmd(t *testing.T) {
// inputs := []struct {
// cmd string
// getOutput bool
// output string
// isErr bool
// }{
// {
// cmd: "echo 'hello world'",
// getOutput: true,
// output: "hello world\n",
// isErr: false,
// },
// {
// cmd: "wr0n6",
// getOutput: true,
// isErr: true,
// },
// }
//
// runner := NewCMDRunner(CMDRunnerOptions{
// RunAsAdmin: false,
// })
//
// for _, input := range inputs {
// descr := fmt.Sprintf("RunCmd(%s,%t)", input.cmd, input.getOutput)
//
// got, _, err := runner.RunCMD(Command{
// Cmd: input.cmd,
// GetOutput: input.getOutput,
// })
// if input.isErr && err == nil {
// t.Errorf("%s expected to fail", descr)
// } else if !input.isErr {
// if err != nil {
// t.Errorf("%s failed: %v", descr, err)
// } else if input.getOutput && input.output != got {
// t.Errorf("%s expected %s but got %s", descr, input.output, got)
// }
// }
// }
//}

func TestRunCmd(t *testing.T) {
inputs := []struct {
cmd string
getOutput bool
output string
isErr bool
}{
{
cmd: "echo 'hello world'",
getOutput: true,
output: "hello world\n",
isErr: false,
},
{
cmd: "wr0n6",
getOutput: true,
isErr: true,
},
}

runner := NewCMDRunner(CMDRunnerOptions{
RunAsAdmin: false,
})

for _, input := range inputs {
descr := fmt.Sprintf("RunCmd(%s,%t)", input.cmd, input.getOutput)

got, _, err := runner.RunCMD(Command{
Cmd: input.cmd,
GetOutput: input.getOutput,
})
if input.isErr && err == nil {
t.Errorf("%s expected to fail", descr)
} else if !input.isErr {
if err != nil {
t.Errorf("%s failed: %v", descr, err)
} else if input.getOutput && input.output != got {
t.Errorf("%s expected %s but got %s", descr, input.output, got)
}
}
}
}

func TestRunBashScript(t *testing.T) {
inputs := []struct {
cmd string
getOutput bool
output string
isErr bool
}{
{
cmd: "echo 'hello world'",
getOutput: true,
output: "hello world\n",
isErr: false,
},
{
cmd: "wr0n6",
getOutput: true,
isErr: true,
},
}

runner := NewCMDRunner(CMDRunnerOptions{
RunAsAdmin: false,
})

for _, input := range inputs {
descr := fmt.Sprintf("RunBashCmd(%s,%t)", input.cmd, input.getOutput)

tmp, err := template.New("script").Parse(string(input.cmd))
if err != nil {
t.Fatalf("Unexpected error at case %q: %v", input.cmd, err)
}

got, err := runner.RunScript(ScriptFile{
Tmp: tmp,
GetOutput: input.getOutput,
})
if input.isErr && err == nil {
t.Errorf("%s expected to fail", descr)
} else if !input.isErr {
if err != nil {
t.Errorf("%s failed: %v", descr, err)
} else if input.getOutput && input.output != got {
t.Errorf("%s expected %s but got %s", descr, input.output, got)
}
}
}
}
// FIXME Test not working on pipeline
//func TestRunBashScript(t *testing.T) {
// inputs := []struct {
// cmd string
// getOutput bool
// output string
// isErr bool
// }{
// {
// cmd: "echo 'hello world'",
// getOutput: true,
// output: "hello world\n",
// isErr: false,
// },
// {
// cmd: "wr0n6",
// getOutput: true,
// isErr: true,
// },
// }
//
// runner := NewCMDRunner(CMDRunnerOptions{
// RunAsAdmin: false,
// })
//
// for _, input := range inputs {
// descr := fmt.Sprintf("RunBashCmd(%s,%t)", input.cmd, input.getOutput)
//
// tmp, err := template.New("script").Parse(string(input.cmd))
// if err != nil {
// t.Fatalf("Unexpected error at case %q: %v", input.cmd, err)
// }
//
// got, err := runner.RunScript(ScriptFile{
// Tmp: tmp,
// GetOutput: input.getOutput,
// })
// if input.isErr && err == nil {
// t.Errorf("%s expected to fail", descr)
// } else if !input.isErr {
// if err != nil {
// t.Errorf("%s failed: %v", descr, err)
// } else if input.getOutput && input.output != got {
// t.Errorf("%s expected %s but got %s", descr, input.output, got)
// }
// }
// }
//}

0 comments on commit e303442

Please sign in to comment.