aboutsummaryrefslogtreecommitdiffstats
path: root/.circleci/config.yml
blob: 81c6c7b60734a137b22b9368012870eeb45e270c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
version: 2

jobs:
  compile:
    docker:
      - image: ubuntu:18.04
        working_directory: ~/nnn
        environment:
          CI_FORCE_TEST: 1
    steps:
      - run:
          command: |
            apt update -qq
            apt install -y --no-install-recommends software-properties-common wget gpg-agent shellcheck
            apt-add-repository -y ppa:jonathonf/gcc-9.1
            wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
            apt-add-repository -y "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main"
            apt update -qq
            apt install -y --no-install-recommends git gcc gcc-8 gcc-9 clang clang-8 clang-tidy-8 make pkg-config libncursesw5-dev libreadline-dev
      - checkout
      - run:
          command: |
            export CFLAGS=-Werror
            make clean
            echo
            echo "########## gcc ##########"
            CC=gcc make strip
            ls -l nnn
            make clean
            echo
            echo "########## gcc-8 ##########"
            CC=gcc-8 make strip
            ls -l nnn
            make clean
            echo
            echo "########## gcc-9 ##########"
            CC=gcc-9 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang ##########"
            CC=clang make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-8 ##########"
            CC=clang-8 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-tidy-8 ##########"
            clang-tidy-8 src/* -- -I/usr/include -I/usr/include/ncursesw
            echo "########## checllcheck ##########"
            find plugins/ -type f -not -name "*.md" -exec shellcheck -e SC1090 {} +

  package-and-publish:
    machine: true
    working_directory: ~/nnn
    steps:
      - checkout
      - run:
          name: "package with packagecore"
          command: |
            # Clean up
            rm -rf ./.git
            rm -rf ./dist/*
            # Pack source
            cd ..
            tar -czf ${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG}.tar.gz ${CIRCLE_PROJECT_REPONAME}
            cd ${CIRCLE_PROJECT_REPONAME}
            # Use latest installed python3 from pyenv
            export PYENV_VERSION="$(pyenv versions | grep -Po '\b3\.\d+\.\d+' | tail -1)"
            pip install packagecore
            packagecore -c misc/packagecore/packagecore.yaml -o ./dist/ ${CIRCLE_TAG#v}
            # Move source pack to dist
            mv ../${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG}.tar.gz dist/

      - run:
          name: "publish to GitHub"
          command: |
            go get github.com/tcnksm/ghr
            ghr -t ${GITHUB_API_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./dist/

workflows:
  version: 2

  test:
    jobs: &all-tests
      - compile

  nightly:
    triggers:
      - schedule:
          cron: "0 0 * * 6"
          filters:
            branches:
              only:
                - master
    jobs: *all-tests

  publish-github-release:
    jobs:
      - package-and-publish:
          filters:
            tags:
              only: /^v.*/
            branches:
              ignore: /.*/