Skip to content

Instantly share code, notes, and snippets.

@srz-zumix
Created March 25, 2020 01:34
Show Gist options
  • Select an option

  • Save srz-zumix/88d9ce04c4c7224604ac624424bfa59d to your computer and use it in GitHub Desktop.

Select an option

Save srz-zumix/88d9ce04c4c7224604ac624424bfa59d to your computer and use it in GitHub Desktop.
.circleci/config.yml NEW
version: 2.1
aliases:
- &branch-filter
branches:
only:
- master
- develop
- /^feature.*/
- /^fix.*/
- /^circleci.*/
- &default
working_directory: ~/srz-zumix/iutest
shell: /bin/bash --login
docker:
- image: circleci/buildpack-deps:disco-curl
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
MAKE_OPTION: -j4 OUTPUTXML=1
MAKE_TARGET: default
MAKE_RUN_TARGET: test
# MAKE_TARGET: all_tests
# MAKE_RUN_TARGET: run_all_tests
- &restore_cache
keys:
# This branch if available
- v2-dep-{{ .Branch }}-
# Default branch if not
- v2-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v2-dep-
- &setup-step
name: SetUp
command: |
sudo apt-get -y --allow-unauthenticated update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
wget -qO - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository -y 'deb http://apt.llvm.org/disco/ llvm-toolchain-disco-9 main'
sudo apt-get -y --allow-unauthenticated update
sudo apt-get -qq install clang-9
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-9
sudo apt-get -qq install g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90 --slave /usr/bin/g++ g++ /usr/bin/g++-8
- &save_cache
key: v2-dep-{{ .Branch }}-{{ epoch }}
paths:
# This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
- &check-version-step
name: check compiler version
working_directory: test
command: |
if [ "$CIRCLE_NODE_INDEX" == "0" ]; then
make showcxxversion;
fi
- &min-tests-and-spec-step
name: minimum_tests and show feature / spec
command: if [ "$CIRCLE_NODE_INDEX" == "0" ]; then make minimum_tests && ./minimum_tests --spec --feature; fi
working_directory: test
- &build-step
name: build
command: |
make clean
case $CIRCLE_NODE_INDEX in \
0) make $MAKE_TARGET $MAKE_OPTION $MAKE_ADD_OPTION OPTIMIZE=-O2 ;; \
1) make $MAKE_TARGET $MAKE_OPTION $MAKE_ADD_OPTION OPTIMIZE=-O3 ;; \
2) make $MAKE_TARGET $MAKE_OPTION $MAKE_ADD_OPTION OPTIMIZE=-Os ;; \
3) make $MAKE_TARGET $MAKE_OPTION $MAKE_ADD_OPTION OPTIMIZE=$FAST_OPTIMIZE ;; \
esac
cp *.json $CIRCLE_ARTIFACTS/ 2>/dev/null || true
working_directory: test
- &test-step
name: run test
command: |
make $MAKE_RUN_TARGET
working_directory: test
- &move-result-step
name: move result xml
command: |
if [ "$CIRCLE_NODE_INDEX" == "0" ]; then
mkdir -p $CIRCLE_TEST_REPORTS/junit/;
find . -type f -regex ".*/test/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;;
fi
- &build-test-steps
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- restore_cache: *restore_cache
- run: *setup-step
- save_cache: *save_cache
# Test
- run: *check-version-step
- run: *min-tests-and-spec-step
- run: *build-step
- run: *test-step
- run: *move-result-step
# Teardown
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
jobs:
gcc_optimize_test:
parallelism: 4
<<: *default
environment:
CXX: g++
FAST_OPTIMIZE: -Og
# FAST_OPTIMIZE: -Ofast # https://github.com/srz-zumix/iutest/issues/396
steps: *build-test-steps
clang_optimize_test:
parallelism: 4
<<: *default
environment:
CXX: clang++
FAST_OPTIMIZE: -Ot
MAKE_ADD_OPTION: CXXFLAGS=-ftime-trace
steps: *build-test-steps
workflows:
version: 2.1
default-test:
jobs:
- gcc_optimize_test:
filters: *branch-filter
- clang_optimize_test:
filters: *branch-filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment