Skip to content

Commit

Permalink
ci: add CI + reslove lint issue (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradumnasaraf authored Jun 7, 2023
1 parent 477f190 commit a7a52b7
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build-format:
name: Build and Format
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build
run: go build -v ./...
- name: Format
run: diff <(gofmt -d .) <(echo -n)

golangci-lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19
cache: false
- name: GolangCI-Lint Check
uses: golangci/golangci-lint-action@v3
1 change: 1 addition & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
welcome:
name: Welcome Step
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:
- main

jobs:
create-tag:
create-tag:
name: Creating tag
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: conventional Changelog Action
- name: Creating Changelog and Release
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
Expand All @@ -23,6 +24,7 @@ jobs:
tag: ${{ steps.changelog.outputs.tag }}

goreleasers:
name: GoReleaser
runs-on: ubuntu-latest
needs: create-tag
# only run if the tag is not empty
Expand Down
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"log"
"os"

"github.com/Pradumnasaraf/scrapy/cmd/ebay"
Expand All @@ -12,7 +13,10 @@ var rootCmd = &cobra.Command{
Use: "scrapy [command] [flags]",
Short: "Scape the web from the command line",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
err := cmd.Help()
if err != nil {
log.Fatal(err)
}
},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/techcrunch/techcrunch-scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strconv"
"strings"

"github.com/Pradumnasaraf/scrapy/helpers"
"github.com/PuerkitoBio/goquery"
"github.com/alexeyco/simpletable"
"github.com/Pradumnasaraf/scrapy/helpers"
)

var cells [][]*simpletable.Cell
Expand Down Expand Up @@ -91,4 +91,4 @@ func createTable() {
table.SetStyle(simpletable.StyleUnicode)
fmt.Println(table.String())

}
}
1 change: 0 additions & 1 deletion helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ func Green(s string) string {
func Purple(s string) string {
return fmt.Sprintf("%s%s%s", ColorPurple, s, ColorDefault)
}

1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright © 2023 Pradumna V Saraf <[email protected]>
*/
package main

Expand Down

0 comments on commit a7a52b7

Please sign in to comment.