github.com/windmeup/goreleaser@v1.21.95/Taskfile.yml (about)

     1  # https://taskfile.dev
     2  
     3  version: "3"
     4  
     5  env:
     6    GO111MODULE: on
     7    GOPROXY: https://proxy.golang.org,direct
     8  
     9  vars:
    10    DOCKER: '{{default "docker" .DOCKER}}'
    11  
    12  tasks:
    13    dev:
    14      desc: Setup git hooks
    15      cmds:
    16        - cp -f scripts/pre-commit.sh .git/hooks/pre-commit
    17  
    18    setup:
    19      desc: Install dependencies
    20      cmds:
    21        - go mod tidy
    22  
    23    build:
    24      desc: Build the binary
    25      sources:
    26        - ./**/*.go
    27      generates:
    28        - ./goreleaser
    29      cmds:
    30        - go build
    31  
    32    test:
    33      desc: Run tests
    34      env:
    35        LC_ALL: C
    36      vars:
    37        TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
    38        SOURCE_FILES: '{{default "./..." .SOURCE_FILES}}'
    39        TEST_PATTERN: '{{default "." .TEST_PATTERN}}'
    40      cmds:
    41        - go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=5m
    42  
    43    cover:
    44      desc: Open the cover tool
    45      cmds:
    46        - go tool cover -html=coverage.txt
    47  
    48    fmt:
    49      desc: gofumpt all code
    50      cmds:
    51        - gofumpt -w -l .
    52  
    53    lint:
    54      desc: Lint the code with golangci-lint
    55      cmds:
    56        - golangci-lint run ./...
    57  
    58    ci:
    59      desc: Run all CI steps
    60      cmds:
    61        - task: setup
    62        - task: build
    63        - task: test
    64  
    65    default:
    66      desc: Runs the default tasks
    67      cmds:
    68        - task: ci
    69  
    70    schema:generate:
    71      desc: Generate JSONSchema
    72      cmds:
    73        - go run . schema -o ./www/docs/static/schema.json
    74      sources:
    75        - pkg/config/config.go
    76      generates:
    77        - ./www/docs/static/schema.json
    78  
    79    docs:generate:
    80      desc: Generate docs
    81      cmds:
    82        - cp -rf CONTRIBUTING.md www/docs/contributing.md
    83        - cp -rf USERS.md www/docs/users.md
    84        - cp -rf EULA.md www/docs/eula.md
    85        - cp -rf SECURITY.md www/docs/security.md
    86      sources:
    87        - CONTRIBUTING.md
    88        - USERS.md
    89        - EULA.md
    90        - SECURITY.md
    91      generates:
    92        - www/docs/contributing.md
    93        - www/docs/users.md
    94        - www/docs/eula.md
    95        - www/docs/security.md
    96  
    97    docs:releases:
    98      desc: Generate releases.json and latest files
    99      cmds:
   100        - ./scripts/get-releases.sh
   101      generates:
   102        - www/docs/static/releases.json
   103        - www/docs/static/releases-pro.json
   104        - www/docs/static/latest
   105        - www/docs/static/latest-pro
   106  
   107    docs:imgs:
   108      desc: Download and resize images
   109      cmds:
   110        - wget -O www/docs/static/logo.png https://raw.githubusercontent.com/goreleaser/artwork/master/goreleaserfundo.png
   111        - wget -O www/docs/static/card.png https://raw.githubusercontent.com/goreleaser/artwork/master/twitter-card.png
   112        - wget -O www/docs/static/avatar.png https://github.com/goreleaser.png
   113        - convert www/docs/static/avatar.png -define icon:auto-resize=64,48,32,16 www/docs/static/favicon.ico
   114        - convert www/docs/static/avatar.png -resize x120 www/docs/static/apple-touch-icon.png
   115  
   116    docs:serve:
   117      desc: Start documentation server
   118      cmds:
   119        - task: docs:generate
   120        - "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
   121        - "{{.DOCKER}} run --rm -p 8000:8000 -v ${PWD}/www:/docs mkdocs"
   122  
   123    docs:build:
   124      desc: Build docs
   125      cmds:
   126        - task: docs:generate
   127        - "{{.DOCKER}} build -t mkdocs -f www/docker/Dockerfile www/docker"
   128        - "{{.DOCKER}} run --rm -v ${PWD}/www:/docs mkdocs build"
   129  
   130    release:
   131      desc: Create a new tag
   132      vars:
   133        NEXT:
   134          sh: svu n
   135      cmds:
   136        - git tag {{.NEXT}}
   137        - echo {{.NEXT}}
   138        - git push origin --tags
   139  
   140    goreleaser:test:pkg:
   141      desc: Test a package
   142      cmds:
   143        - docker run --platform linux/{{.Platform}} --rm --workdir /tmp -v $PWD/dist:/tmp {{.Image}} sh -c '{{.Cmd}} && goreleaser --version'
   144  
   145    goreleaser:test:rpm:
   146      desc: Tests rpm packages
   147      vars:
   148        rpm: "rpm --nodeps -ivh"
   149      cmds:
   150        - task: goreleaser:test:pkg
   151          vars:
   152            Platform: "386"
   153            Image: centos:centos7
   154            Cmd: "{{.rpm}} goreleaser-*.i386.rpm"
   155        - task: goreleaser:test:pkg
   156          vars:
   157            Platform: "amd64"
   158            Image: fedora
   159            Cmd: "{{.rpm}} goreleaser-*.x86_64.rpm"
   160        - task: goreleaser:test:pkg
   161          vars:
   162            Platform: "arm64"
   163            Image: fedora
   164            Cmd: "{{.rpm}} goreleaser-*.aarch64.rpm"
   165  
   166    goreleaser:test:deb:
   167      desc: Tests deb packages
   168      vars:
   169        dpkg: "dpkg --ignore-depends=git -i"
   170      cmds:
   171        - task: goreleaser:test:pkg
   172          vars:
   173            Platform: "amd64"
   174            Image: ubuntu
   175            Cmd: "{{.dpkg}} goreleaser*_amd64.deb"
   176        - task: goreleaser:test:pkg
   177          vars:
   178            Platform: "arm64"
   179            Image: ubuntu
   180            Cmd: "{{.dpkg}} goreleaser*_arm64.deb"
   181        - task: goreleaser:test:pkg
   182          vars:
   183            Platform: "arm/7"
   184            Image: ubuntu
   185            Cmd: "{{.dpkg}} goreleaser*_armhf.deb"
   186  
   187    goreleaser:test:apk:
   188      desc: Tests apk packages
   189      vars:
   190        apk: "apk add --allow-untrusted -U"
   191      cmds:
   192        - task: goreleaser:test:pkg
   193          vars:
   194            Platform: "386"
   195            Image: alpine
   196            Cmd: "{{.apk}} goreleaser*_x86.apk"
   197        - task: goreleaser:test:pkg
   198          vars:
   199            Platform: "amd64"
   200            Image: alpine
   201            Cmd: "{{.apk}} goreleaser*_x86_64.apk"
   202        - task: goreleaser:test:pkg
   203          vars:
   204            Platform: "arm64"
   205            Image: alpine
   206            Cmd: "{{.apk}} goreleaser*_aarch64.apk"
   207        - task: goreleaser:test:pkg
   208          vars:
   209            Platform: "arm/7"
   210            Image: alpine
   211            Cmd: "{{.apk}} goreleaser*_armv7.apk"
   212  
   213    goreleaser:test:
   214      desc: Test built linux packages
   215      cmds:
   216        - task: goreleaser:test:apk
   217        - task: goreleaser:test:deb
   218        - task: goreleaser:test:rpm
   219  
   220    goreleaser:
   221      desc: Run GoReleaser either in snapshot or release mode
   222      deps:
   223        - build
   224      vars:
   225        SNAPSHOT:
   226          sh: 'if [[ $GITHUB_REF != refs/tags/v* ]]; then echo "--snapshot"; fi'
   227      cmds:
   228        - ./goreleaser release --clean --timeout 60m {{.SNAPSHOT}}
   229  
   230    nightly:
   231      cmds:
   232        - gh run list --workflow=nightly-oss.yml
   233        - gh workflow run nightly-oss.yml
   234        - sleep 30
   235        - gh run watch