summaryrefslogtreecommitdiffstats
path: root/.circleci/config.yml
blob: 4b6a58ba75f7e8d60367e6640e223567c44ed525 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
version: 2

jobs:
  compile:
    docker:
      - image: ubuntu:20.04
        working_directory: ~/nnn
        environment:
          CI_FORCE_TEST: 1
    steps:
      - run:
          command: |
            apt update -qq
            DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get -y install tzdata
            apt install -y --no-install-recommends software-properties-common wget gpg-agent shellcheck
            apt install -y --no-install-recommends git make pkg-config libncurses-dev libreadline-dev
            apt install -y --no-install-recommends gcc-7 gcc-8 gcc-9 gcc-10
            apt install -y --no-install-recommends clang-6.0 clang-7 clang-8 clang-9 clang-10 clang-11 clang-tidy-11
      - checkout
      - run:
          command: |
            export CFLAGS=-Werror
            make clean
            echo
            echo "########## gcc-7 ##########"
            CC=gcc-7 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 "########## gcc-10 ##########"
            CC=gcc-10 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-6 ##########"
            CC=clang-6.0 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-7 ##########"
            CC=clang-7 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-8 ##########"
            CC=clang-8 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-9 ##########"
            CC=clang-9 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-10 ##########"
            CC=clang-10 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-11 ##########"
            CC=clang-11 make strip
            ls -l nnn
            make clean
            echo
            echo "########## clang-tidy-11 ##########"
            clang-tidy-11 src/* -- -I/usr/include -I/usr/include/ncursesw
            echo "########## shellcheck ##########"
            find plugins/ -type f -not -name "*.md" -exec shellcheck {} +

  package-and-publish:
    machine: true
    working_directory: ~/nnn
    steps:
      - checkout
      - run:
          name: "auto-generate packages"
          command: |
            # Create dist directory if it doesn't exist
            mkdir ./dist
            # Clean up
            rm -rf ./dist/*
            # Pack source
            git archive -o ../${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG}.tar.gz --format tar.gz --prefix=${CIRCLE_PROJECT_REPONAME}-${CIRCLE_TAG#v}/ ${CIRCLE_TAG}
            # 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 install github.com/tcnksm/ghr@latest
            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: /.*/