Skip to content

Commit

Permalink
init code
Browse files Browse the repository at this point in the history
  • Loading branch information
johlanse committed Nov 12, 2021
0 parents commit 28d0a19
Show file tree
Hide file tree
Showing 30 changed files with 1,896 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on: [push, pull_request]

env:
BINARY_PREFIX: "study_xxqg_"
BINARY_SUFFIX: ""
PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request."
LD_FLAGS: "-w -s"

jobs:
build:
name: Build binary CI
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows]
goarch: [amd64]
exclude:
- goos: darwin
goarch: arm
- goos: darwin
goarch: "386"
- goos: windows
goarch: arm64
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: 1.17
- name: Build binary file
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
IS_PR: ${{ !!github.head_ref }}
run: |
if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi
if $IS_PR ; then echo $PR_PROMPT; fi
export BINARY_NAME="$BINARY_PREFIX$GOOS_$GOARCH$BINARY_SUFFIX"
export CGO_ENABLED=0
go build -o "output/$BINARY_NAME" -ldflags "-w -s -X main.VERSION=action"
- name: Upload artifact
uses: actions/upload-artifact@v2
if: ${{ !github.head_ref }}
with:
name: ${{ matrix.goos }}_${{ matrix.goarch }}
path: output/

41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17.2'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
# main: ./example/main.go
GITHUB_TOKEN: ${{ secrets.TOKEN }}
#- name: Checkout Dist
# uses: actions/checkout@v2
# with:
# repository: 'gocq/dist'
# ref: master
# ssh-key: ${{ secrets.SSH_KEY }}
# path: upstream/dist

#- name: Update Dist
# run: |
# chmod +x scripts/upload_dist.sh
# ./scripts/upload_dist.sh
94 changes: 94 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
linters-settings:
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*
ignoretests: true

goimports:
local-prefixes: github.com/huoxue1/study_xxqg

gocritic:
disabled-checks:
- exitAfterDefer

forbidigo:
# Forbid the following identifiers
forbid:
- ^fmt\.Errorf$ # consider errors.Errorf in github.com/pkg/errors

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
fast: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- exhaustive
#- funlen
#- goconst
- gocritic
#- gocyclo
- gofmt
- goimports
- goprintffuncname
#- gosec
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- prealloc
- predeclared
- asciicheck
- forbidigo
- makezero
- revive
#- interfacer

# don't enable:
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - testpackage
# - wsl

run:
# default concurrency is a available CPU number.
# concurrency: 4 # explicitly omit this value to fully utilize available resources.
deadline: 5m
issues-exit-code: 1
tests: false

# output configuration options
output:
format: "colored-line-number"
print-issued-lines: true
print-linter-name: true
uniq-by-line: true

issues:
# Fix found issues (if it's supported by the linter)
fix: true
exclude-use-default: false
exclude:
- "Error return value of .((os.)?std(out|err)..*|.*Close|.*Flush|os.Remove(All)?|.*print(f|ln)?|os.(Un)?Setenv). is not check"
91 changes: 91 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:

- id: nowin
env:
- CGO_ENABLED=0
- GO111MODULE=on
goos:
- linux
# - darwin
goarch:
- 386
- amd64
# - arm
# - arm64
# goarm:
# - 7
# ignore:
# - goos: darwin
# goarch: arm
# - goos: darwin
# goarch: 386
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w -X main.VERSION=v{{.Version}}
- id: win
env:
- CGO_ENABLED=0
- GO111MODULE=on
goos:
- windows
goarch:
- 386
- amd64
# - arm
goarm:
- 7
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w -X main.VERSION=v{{.Version}}

checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- fix typo
- Merge pull request
- Merge branch
- Merge remote-tracking
- go mod tidy

archives:
- id: binary
builds:
- win
- nowin
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format_overrides:
- goos: windows
format: binary
- goos: linux
format: binary
- id: nowin
builds:
- nowin
- win
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format_overrides:
- goos: windows
format: zip

nfpms:
- license: AGPL 3.0
homepage: https://github.com/huoxue1/study_xxqg
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
formats:
- deb
- rpm
maintainer: HuoXue1
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/study_xxqg.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### 学习强国自动化学习



## 使用

+ 从release下载对应版本压缩包
+ 首次打开会在 ```config\config.yml```生成默认配置文件
+ 再次打开即可运行


## 申明,该项目仅用于学习。

## 鸣谢

+ ### [imkenf/XueQG](https://github.com/imkenf/XueQG)
5 changes: 5 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 刷课模式,默认为1,
# 1:只刷文章何视频
# 2:只刷文章和视频和每日答题
# 3:刷文章和视频和每日答题每周答题和专项答题
model: 1
1 change: 1 addition & 0 deletions config/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"cookies":[{"name":"_uab_collina","value":"163662103329486079242507","domain":"pc.xuexi.cn","path":"/points","expires":1951981033,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"__UID__","value":"5cdc19a0-42cd-11ec-b6bc-e3c5195d165e","domain":".xuexi.cn","path":"/","expires":1668157033,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"tmzw","value":"1636621034119","domain":".xuexi.cn","path":"/","expires":1636707434,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"zwfigprt","value":"297bce38be89bc8a076e6e29b6282c1c","domain":".xuexi.cn","path":"/","expires":1636707434,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"aliyungf_tc","value":"003c420ac17482ba6ad5550439dfb427add3b6076673bc476f0beeb76d7abdf6","domain":"pc-api.xuexi.cn","path":"/","expires":-1,"httpOnly":true,"secure":false,"same_site":"None"},{"name":"acw_tc","value":"2f6fc10416366210318943764e7c9b024dcd55ba787fb0c5064287171f5d3d","domain":"pc-api.xuexi.cn","path":"/","expires":1636622834,"httpOnly":true,"secure":false,"same_site":"None"},{"name":"aliyungf_tc","value":"171ba83785f1d8fb9d76af9bbb376840828ef4710300b5854145bf5e7fec3c1f","domain":"login.xuexi.cn","path":"/","expires":-1,"httpOnly":true,"secure":false,"same_site":"None"},{"name":"acw_tc","value":"2f6fc10416366210325768127e7c9adce9f228d7e2f62ece3cd09618ee90d6","domain":"login.xuexi.cn","path":"/","expires":1636622835,"httpOnly":true,"secure":false,"same_site":"None"},{"name":"_bl_uid","value":"nhkb8v0kuyzpFzw6Xptyftdj3b03","domain":"login.xuexi.cn","path":"/","expires":1652173035,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"_bl_uid","value":"bhkFmvUOuw7p1swt3pe4kCdf22g3","domain":"www.xuexi.cn","path":"/","expires":1652173036,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"_bl_uid","value":"94k6yvb2u6apejwFCpekkm5u6e79","domain":"pc.xuexi.cn","path":"/","expires":1652173036,"httpOnly":false,"secure":false,"same_site":"None"},{"name":"token","value":"143ed9a00afe4c1fbcf1eae8acfdeca3","domain":".xuexi.cn","path":"/","expires":1636642691,"httpOnly":false,"secure":false,"same_site":"None"}],"nick":"苟江山","uid":"151142372517"}]
41 changes: 41 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module github.com/huoxue1/study_xxqg

go 1.17

replace github.com/willf/bitset v1.2.1 => github.com/bits-and-blooms/bitset v1.2.1

require (
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f
github.com/guonaihong/gout v0.2.9
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/mxschmitt/playwright-go v0.1100.0
github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
github.com/tidwall/gjson v1.11.0
github.com/tuotoo/qrcode v0.0.0-20190222102259-ac9c44189bf2
gopkg.in/yaml.v2 v2.2.8
)

require (
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lestrrat-go/strftime v1.0.5 // indirect
github.com/maruel/rs v0.0.0-20150922171536-2c81c4312fe4 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/willf/bitset v1.2.1 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
)
Loading

0 comments on commit 28d0a19

Please sign in to comment.