diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..358a6a409 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,87 @@ +version: 2 + + +variables: + + macos: &macos + macos: + xcode: "9.0" + environment: + CIRCLE_ARTIFACTS: /tmp/circleci/artifacts + + restore_cache: &restore_cache + restore_cache: + keys: + # This branch if available + - v1-dep-{{ .Branch }}- + # Default branch if not + - v1-dep-master- + + save_cache: &save_cache + save_cache: + key: v1-dep-{{ .Branch }}-{{ epoch }} + paths: + - .cache + + setup: &setup + run: + name: Setting-up build environment + command: ./ci/circle.sh setup + + build: &build + run: + name: Running tests and building distribution + command: ./ci/circle.sh build + + store_artifacts: &store_artifacts + store_artifacts: + path: /tmp/circleci/artifacts + + deploy: &deploy + run: + name: Deploying to GitHub + command: ./ci/circle.sh deploy + +jobs: + + build_and_test: + <<: *macos + steps: + - checkout + - *restore_cache + - *setup + - *build + - *store_artifacts + - *save_cache + + build_test_and_release: + <<: *macos + steps: + - checkout + - *restore_cache + - *setup + - *build + - *store_artifacts + - *deploy + - *save_cache + + +workflows: + + version: 2 + + branch: + jobs: + - build_and_test: + filters: + tags: + ignore: /.*/ + + tag: + jobs: + - build_test_and_release: + filters: + branches: + ignore: /.*/ + tags: + only: /.*/ diff --git a/MANIFEST.in b/MANIFEST.in index 62df96884..95d6c1b1a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -38,5 +38,6 @@ exclude archlinux/.gitignore exclude plover/gui_qt/*_rc.py exclude plover/gui_qt/*_ui.py exclude plover/gui_qt/.gitignore +prune .circleci prune .github prune ci diff --git a/ci/circle.sh b/ci/circle.sh index c03bf6a93..f722b6f39 100755 --- a/ci/circle.sh +++ b/ci/circle.sh @@ -36,6 +36,7 @@ download() setup() { + mkdir -p "$CIRCLE_ARTIFACTS" # Install Python. download 'python36.pkg' 'https://www.python.org/ftp/python/3.6.2/python-3.6.2-macosx10.6.pkg' '86e6193fd56b1e757fc8a5a2bb6c52ba' run sudo installer -pkg "$downloads/python36.pkg" -target / @@ -47,7 +48,6 @@ setup() build() { - run git fetch --quiet --unshallow run "$python" setup.py patch_version run "$python" setup.py test run "$python" setup.py bdist_dmg @@ -61,15 +61,14 @@ deploy() github_release_url='https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2' github_release_sha1='16d40bcb4de7e29055789453f0d5fdbf1bfd3b49' github_release_exe='./bin/darwin/amd64/github-release' - github_release_opts=(--user openstenoproject --repo plover --tag "$("$python" ./setup.py --version)") + github_release_opts=(--user "$CIRCLE_PROJECT_USERNAME" --repo "$CIRCLE_PROJECT_REPONAME" --tag "$CIRCLE_TAG") run [ -r "$artifact" ] run "$python" -m plover_build_utils.download "$github_release_url" "$github_release_sha1" "$github_release" run tar xvjf "$github_release" run "$github_release_exe" release "${github_release_opts[@]}" --draft - run "$github_release_exe" upload "${github_release_opts[@]}" --file "$artifact" --name "${artifact#*/}" + run "$github_release_exe" upload "${github_release_opts[@]}" --file "$artifact" --name "${artifact##*/}" } -[ "$CIRCLE_BUILD_IMAGE" == 'osx' ] [ $# -eq 1 ] python='python3' diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 2ad4ed05b..000000000 --- a/circle.yml +++ /dev/null @@ -1,23 +0,0 @@ -machine: - pre: - # virtualenv is automatically used by CircleCI, - # but it's not available in the macOS image. - - curl https://bootstrap.pypa.io/get-pip.py | sudo python - - - sudo -H pip install --upgrade virtualenv - -dependencies: - override: - - ./ci/circle.sh setup - cache_directories: - - .cache - -test: - override: - - ./ci/circle.sh build - -deployment: - release: - tag: /.+/ - owner: openstenoproject - commands: - - ./ci/circle.sh deploy diff --git a/requirements.txt b/requirements.txt index 4aa168559..24d6dc640 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ Babel==2.4.0 check-manifest==0.35 Cython==0.25.2 -dmgbuild==1.3.2; "darwin" in sys_platform +https://github.com/benoit-pierre/dmgbuild/archive/plover.zip; "darwin" in sys_platform docutils==0.14 macholib==1.8; "darwin" in sys_platform pip==9.0.1