From 94512166069d04f7e04bdfad6a1931703227d10d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 2 Jun 2020 00:27:52 -0400 Subject: [PATCH] refactor: build the package separately from running ci --- .github/workflows/ci.yaml | 36 ++++++++++++++++++++++++++++-------- tests/ci/setup.sh | 26 +++++++++++++++++++------- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5c108ac30..010607684 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,21 +10,41 @@ on: jobs: build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - index: [0, 1, 2,3] - env: - GITHUB_NODE_INDEX: ${{ matrix.compiler }} name: ci.${{ matrix.index }} - steps: - uses: actions/checkout@v2 - name: install ci-dependencies run: make ci-dependencies + - name: build package + run: ./tests/ci/setup.sh build + + - name: upload packages + uses: actions/upload-artifact@v2 + with: + name: build + path: build + + ci: + env: + GITHUB_NODE_INDEX: ${{ matrix.compiler }} + name: ci.${{ matrix.index }} + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + index: [0, 1, 2,3] + + steps: + - uses: actions/checkout@v2 + + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build + - name: setup tests run: ./tests/ci/setup.sh diff --git a/tests/ci/setup.sh b/tests/ci/setup.sh index 7eff42a7c..d12d3305b 100755 --- a/tests/ci/setup.sh +++ b/tests/ci/setup.sh @@ -40,6 +40,11 @@ install_dependencies() { } build_dokku() { + if [[ "$FROM_SOURCE" == "true" ]]; then + sudo -E CI=true make -e install + return + fi + echo "=====> build_dokku on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" "${ROOT_DIR}/contrib/release-dokku" build } @@ -47,13 +52,10 @@ build_dokku() { install_dokku() { echo "=====> install_dokku on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - if [[ "$FROM_SOURCE" == "true" ]]; then - sudo -E CI=true make -e install - return + if [[ ! -f "${ROOT_DIR}/build/deb-filename" ]]; then + build_dokku fi - build_dokku - echo "dokku dokku/hostname string dokku.me" | sudo debconf-set-selections echo "dokku dokku/key_file string /root/.ssh/id_rsa.pub" | sudo debconf-set-selections echo "dokku dokku/nginx_enable boolean true" | sudo debconf-set-selections @@ -102,14 +104,19 @@ check_container() { done } -# shellcheck disable=SC2120 -setup_circle() { +create_package() { echo "=====> setup_circle on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" sudo -E CI=true make -e sshcommand # need to add the dokku user to the docker group sudo usermod -G docker dokku [[ "$1" == "buildstack" ]] && BUILD_STACK=true make -e stack + install_dependencies + build_dokku +} + +# shellcheck disable=SC2120 +setup_circle() { install_dependencies install_dokku @@ -129,6 +136,11 @@ case "$1" in build_dokku_docker_image run_dokku_container ;; + build) + # shellcheck disable=SC2119 + create_package + exit $? + ;; *) # shellcheck disable=SC2119 setup_circle