diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..833173bf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build Go Sample Projects + +on: + push: + branches: + - main + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.22' + + - name: Build projects + run: | + #!/bin/bash + cd /home/runner/work/samples-go/samples-go + + for dir in */; do + if [ -d "$dir" ] && [ -f "${dir}go.mod" ]; then + echo "Building project in $dir" + + # Change to the project directory + cd "$dir" || continue + + # Build the project + if go build -o app; then + echo "Successfully built $dir" + else + echo "Failed to build $dir" >&2 + exit 1 + fi + + # Return to the base directory + cd .. + else + echo "Skipping $dir, no go.mod file found." + fi + done + + echo "All projects processed." diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 9f4248a9..08fa2d79 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,10 +26,17 @@ jobs: fail-fast: false matrix: working-directory: + - echo-mysql - echo-sql + - fasthttp-postgres - gin-mongo - gin-redis + - go-jwt + - go-twilio - graphql-sql + - http-pokeapi + - mux-elasticsearch + - mux-mysql - mux-sql - S3-Keploy - sse-svelte diff --git a/http-pokeapi/main.go b/http-pokeapi/main.go index b12daffe..3e3af927 100644 --- a/http-pokeapi/main.go +++ b/http-pokeapi/main.go @@ -14,7 +14,7 @@ type apiconfig struct { } func main() { - time.Sleep[2*time.Second] + time.Sleep(2 * time.Second) cfg := &apiconfig{ client: pokeapi.Client{}, }