refactor: build the package separately from running ci
This commit is contained in:
36
.github/workflows/ci.yaml
vendored
36
.github/workflows/ci.yaml
vendored
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user