Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build/test with latest Go 1.22 for arm64 rather than x86 #6

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
interval: weekly
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
69 changes: 0 additions & 69 deletions .github/workflows/github_release.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/release-on-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release on PR Merge

on: deployment

jobs:
deploy:
if: github.event.deployment.environment == 'production'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Setup git
run: |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"

- name: Build artifacts
run: |
go run build/make.go --all-platforms
go run build/make.go --all-platforms --distro

- name: update
run: |
if [ -z "$version" ]; then
version=$(cd deploy && ls screenshot* | head -1 | sed "s/\.[^\.]*$//" | sed "s/screenshot-//" | sed | sed "s/-[a-z]*\.[a-z0-9_]*$//");
fi
echo "VERSION=$version" >> $GITHUB_ENV

echo "---------------------------"
echo "Updating release v$version"
echo "---------------------------"
echo -e "Gauge Screenshot v$version\n\n" > desc.txt
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge_screenshot)
echo "$release_description" >> desc.txt
gh release create --title "Gauge Screenshot v${version}" --notes-file ./desc.txt "v${version}" deploy/*

- name: Update metadata in gauge-repository
run: |
git clone https://github.com/getgauge/gauge-repository.git
cd gauge-repository
python update_metadata.py screenshot $VERSION
commit_message=$(echo -e "Update screenshot to v$VERSION")
git commit -am "$commit_message"
git push "https://$GITHUB_ACTOR:[email protected]/getgauge/gauge-repository.git" master
12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- uses: actions/checkout@v4

- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Test
run: go test ./...
29 changes: 12 additions & 17 deletions build/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand All @@ -33,10 +32,7 @@ import (
)

const (
CGO_ENABLED = "CGO_ENABLED"
)

const (
CGO_ENABLED = "CGO_ENABLED"
dotGauge = ".gauge"
plugins = "plugins"
GOARCH = "GOARCH"
Expand Down Expand Up @@ -75,7 +71,7 @@ func compile() {
if *allPlatforms {
compileAcrossPlatforms()
} else {
compileGoPackage(screenshot)
compileGoPackage()
}
}

Expand Down Expand Up @@ -180,7 +176,7 @@ func mirrorDir(src, dst string) error {
}
suffix, err := filepath.Rel(src, path)
if err != nil {
return fmt.Errorf("Failed to find Rel(%q, %q): %v", src, path, err)
return fmt.Errorf("failed to find Rel(%q, %q): %v", src, path, err)
}
return mirrorFile(path, filepath.Join(dst, suffix))
})
Expand All @@ -204,7 +200,7 @@ func executeCommand(command string, arg ...string) (string, error) {
return strings.TrimSpace(fmt.Sprintf("%s", bytes)), err
}

func compileGoPackage(packageName string) {
func compileGoPackage() {
runProcess("go", "build", "-o", getGaugeExecutablePath(gaugeScreenshot))
}

Expand Down Expand Up @@ -280,24 +276,23 @@ var binDir = flag.String("bin-dir", "", "Specifies OS_PLATFORM specific binaries

var (
platformEnvs = []map[string]string{
map[string]string{GOARCH: x86, goOS: DARWIN, CGO_ENABLED: "0"},
map[string]string{GOARCH: x86_64, goOS: DARWIN, CGO_ENABLED: "0"},
map[string]string{GOARCH: x86, goOS: LINUX, CGO_ENABLED: "0"},
map[string]string{GOARCH: ARM64, goOS: DARWIN, CGO_ENABLED: "0"},
map[string]string{GOARCH: x86_64, goOS: LINUX, CGO_ENABLED: "0"},
map[string]string{GOARCH: ARM64, goOS: LINUX, CGO_ENABLED: "0"},
map[string]string{GOARCH: x86, goOS: WINDOWS, CC: "i586-mingw32-gcc", CGO_ENABLED: "1"},
map[string]string{GOARCH: x86_64, goOS: WINDOWS, CC: "x86_64-w64-mingw32-gcc", CGO_ENABLED: "1"},
map[string]string{GOARCH: ARM64, goOS: WINDOWS, CC: "aarch64-w64-mingw32-gcc", CGO_ENABLED: "1"},
}
)

func getPluginProperties(jsonPropertiesFile string) (map[string]interface{}, error) {
pluginPropertiesJson, err := ioutil.ReadFile(jsonPropertiesFile)
pluginPropertiesJson, err := os.ReadFile(jsonPropertiesFile)
if err != nil {
fmt.Printf("Could not read %s: %s\n", filepath.Base(jsonPropertiesFile), err)
return nil, err
}
var pluginJson interface{}
if err = json.Unmarshal([]byte(pluginPropertiesJson), &pluginJson); err != nil {
if err = json.Unmarshal(pluginPropertiesJson, &pluginJson); err != nil {
fmt.Printf("Could not read %s: %s\n", filepath.Base(jsonPropertiesFile), err)
return nil, err
}
Expand All @@ -309,7 +304,7 @@ func compileAcrossPlatforms() {
setEnv(platformEnv)
fmt.Printf("Compiling for platform => OS:%s ARCH:%s \n", platformEnv[goOS], platformEnv[GOARCH])
runProcess("go", "get", "./...")
compileGoPackage(screenshot)
compileGoPackage()
}
}

Expand Down Expand Up @@ -361,10 +356,10 @@ func getGOARCH() string {
}

func getGOOS() string {
os := os.Getenv(goOS)
if os == "" {
goOs := os.Getenv(goOS)
if goOs == "" {
return runtime.GOOS

}
return os
return goOs
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/getgauge/gauge_screenshot

go 1.13
go 1.22

require (
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc
github.com/TheTitanrain/w32 v0.0.0-20200114052255-2654d97dbd3d
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf h1:FPsprx82rdrX2jiKyS17BH6IrTmUBYqZa/CXT4uvb+I=
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I=
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc h1:7D+Bh06CRPCJO3gr2F7h1sriovOZ8BMhca2Rg85c2nk=
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/TheTitanrain/w32 v0.0.0-20200114052255-2654d97dbd3d h1:2xp1BQbqcDDaikHnASWpVZRjibOxu7y9LhAv04whugI=
github.com/TheTitanrain/w32 v0.0.0-20200114052255-2654d97dbd3d/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I=
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id" : "screenshot",
"version" : "0.1.0",
"version" : "0.2.0",
"name" : "Screenshot",
"description" : "cross-platform command line screenshot utility",
"scope" : [],
Expand Down
15 changes: 0 additions & 15 deletions release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

package version

var Version = "0.1.0"
var Version = "0.2.0"