diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0b443f3..93d4d3a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,24 +5,39 @@ name: Go on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: - - build: + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + + - name: Verify dependencies + run: go mod verify + + - name: Run go fmt + run: | + if [ -n "$(go fmt ./...)" ]; then + echo "Please run go fmt on your code" + exit 1 + fi + + - name: Run tests + run: go test -v ./... - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.20' + - name: Run vet + run: go vet ./... - - name: Build - run: go build -v ./... + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest - - name: Test - run: go test -v ./... + - name: Run staticcheck + run: staticcheck ./... diff --git a/.github/workflows/update-stats.yml b/.github/workflows/update-stats.yml new file mode 100644 index 0000000..8dae67d --- /dev/null +++ b/.github/workflows/update-stats.yml @@ -0,0 +1,72 @@ +name: Update Repository Statistics + +on: + push: + branches: ["main"] + paths: + - "easy/**" + - "medium/**" + - "hard/**" + +jobs: + update-stats: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Update Statistics + run: | + python3 - <