github.com/nuvolaris/nuv@v0.0.0-20240511174247-a74e3a52bfd8/Taskfile.yml (about)

     1  # Licensed to the Apache Software Foundation (ASF) under one
     2  # or more contributor license agreements.  See the NOTICE file
     3  # distributed with this work for additional information
     4  # regarding copyright ownership.  The ASF licenses this file
     5  # to you under the Apache License, Version 2.0 (the
     6  # "License"); you may not use this file except in compliance
     7  # with the License.  You may obtain a copy of the License at
     8  #
     9  #   http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing,
    12  # software distributed under the License is distributed on an
    13  # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    14  # KIND, either express or implied.  See the License for the
    15  # specific language governing permissions and limitations
    16  # under the License.
    17  #
    18  version: "3"
    19  
    20  vars:
    21    BRANCH: 3.0.0
    22    BASEVER: "3.0.1-beta"
    23    VERSION:
    24      sh: git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD
    25    S: ""
    26    DEBUG: ""
    27  
    28  tasks:
    29    default:
    30      - task: build
    31  
    32    cli-ver:
    33      - git tag -d $(git tag)
    34      - git tag -f {{.BASEVER}}.$(date +%y%m%d%H%M){{.S}}
    35      - git tag
    36  
    37    setup: { silent:true }
    38  
    39    build:
    40      desc: build nuv locally
    41      cmds:
    42        - >
    43          curl -sL https://raw.githubusercontent.com/nuvolaris/olaris/{{.BRANCH}}/runtimes.json 
    44          | jq '{"runtimes": .runtimes}' >runtimes.json
    45        - go build {{.DEBUG}} -ldflags "-X main.NuvVersion={{.VERSION}} -X main.NuvBranch={{.BRANCH}}"  -o bin/nuv
    46      sources:
    47        - "*.go"
    48        - "tools/*.go"
    49      generates:
    50        - bin/nuv
    51  
    52    debug:
    53      cmds:
    54        - task: build
    55          vars:
    56            DEBUG: "-gcflags '-l -N'"
    57        - dlv exec ./bin/nuv -- {{.CLI_ARGS}}
    58  
    59    install:
    60      desc: install nuv using a local folder for binaries
    61      deps:
    62        - build
    63      dir: bin
    64      cmds:
    65        - ./nuv getall
    66        - sudo rm -f /usr/bin/nuv /usr/local/bin/nuv
    67        - sudo ln -sf $PWD/{{OS}}/{{ARCH}}/nuv /usr/local/bin/nuv
    68        - sudo ln -sf $PWD/{{OS}}/{{ARCH}}/nuv /usr/bin/nuv
    69  
    70    test:
    71      desc: tests all
    72      cmds:
    73        - task: install
    74        - task: utest
    75        - task: itest
    76  
    77    utest:
    78      desc: unit test nuv
    79      cmds:
    80        - rm -Rf ~/.nuv/olaris
    81        - go test ./...
    82  
    83    itest:
    84      desc: integration tests nuv
    85      dir: tests
    86      cmds:
    87        - rm -Rf ~/.nuv/olaris
    88        - bats/bin/bats .
    89  
    90    clean:
    91      - rm -f bin/nuv runtimes.json
    92      - go clean -cache -modcache
    93  
    94    rebuild:
    95      - rm -f bin/nuv
    96      - task: build
    97  
    98    utestdiff:
    99      cmds:
   100        - |-
   101          if test -z '{{.N}}'
   102          then  go test -v | tee _difftest
   103                python3 difftest.py
   104          else  python3 difftest.py {{.N}}
   105          fi
   106  
   107    sync-wsk:
   108      - |
   109        NOW=$(date +%y%m%d%H%M)
   110        cd tools/openwhisk-wskdeploy
   111        git tag -d $(git tag)
   112        git commit -m $NOW -a
   113        git tag v0.0.0.$NOW
   114        git push origin nuvolaris --tags
   115        cd ../openwhisk-cli
   116        git tag -d $(git tag)
   117        go get github.com/nuvolaris/openwhisk-wskdeploy@v0.0.0.$NOW
   118        git commit -m $NOW -a
   119        git tag v0.0.0.$NOW
   120        git push origin nuvolaris --tags
   121        cd ../..
   122        go get github.com/nuvolaris/openwhisk-cli@v0.0.0.$NOW
   123        git add tools/openwhisk-cli
   124        git add tools/openwhisk-wskdeploy
   125        git add go.mod go.sum
   126  
   127    sync-task:
   128      - |
   129        NOW=$(date +%y%m%d%H%M)
   130        cd tools/sh
   131        go get github.com/nuvolaris/nuv@9e76cabec87cc4908fd4c4a6571927283a28a991
   132        go mod tidy
   133        git tag -d $(git tag)
   134        git commit -m $NOW -a
   135        git tag v3.7.1-nuv.$NOW
   136        git push origin nuvolaris --tags
   137        cd ../task
   138        git tag -d $(git tag)
   139        go get github.com/nuvolaris/sh/v3@v3.7.1-nuv.$NOW
   140        git commit -m $NOW -a
   141        git tag v3.30.2-nuv.$NOW
   142        git push origin nuvolaris --tags
   143        cd ../..
   144        go get github.com/nuvolaris/task/v3@v3.30.2-nuv.$NOW
   145  
   146  
   147