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