Skip to content

Commit

Permalink
GH Action build process changed
Browse files Browse the repository at this point in the history
GH Action build process changed
  • Loading branch information
ruzickap committed Jan 12, 2020
1 parent d47b354 commit 734eee1
Showing 1 changed file with 71 additions and 26 deletions.
97 changes: 71 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,92 @@ jobs:
echo "*** Creating new file: ${PACKER_CACHE_DIR}/BOX_VERSION | ${BOX_VERSION}"
echo "${BOX_VERSION}" > "${PACKER_CACHE_DIR}/BOX_VERSION"
build:
##############
# libvirt
##############

build-libvirt:
name: "*"
runs-on: [self-hosted, linux, x64]
needs: prebuild
env:
# BOX_VERSION: "20190608.01"
# DOCKER_COMMAND: docker
PACKER_IMAGES_OUTPUT_DIR: /var/tmp/packer-templates-images
PACKER_CACHE_DIR: /var/tmp/packer_cache
LOGDIR: /var/tmp/packer-templates-logs
VAGRANTUP_USER: peru
VAGRANTUP_ACCESS_TOKEN: ${{ secrets.VAGRANTUP_ACCESS_TOKEN }}
# PACKER_RUN_TIMEOUT: 18000
# USE_DOCKERIZED_PACKER: "true"
# PACKER_LOG: 1
# VAGRANT_LOG: info

strategy:
max-parallel: 1
max-parallel: 2
matrix:
stage:
- windows-server-2012_r2-standard-x64-eval-libvirt
- my_centos-7-x86_64-libvirt
- my_ubuntu-18.04-server-amd64-libvirt
- my_ubuntu-18.04-server-amd64-virtualbox
- my_windows-10-enterprise-x64-eval-libvirt
- ubuntu-16.04-server-amd64-libvirt
- ubuntu-16.04-server-amd64-virtualbox
- ubuntu-18.04-server-amd64-libvirt
- ubuntu-18.04-server-amd64-virtualbox
- ubuntu-19.04-desktop-amd64-libvirt
- ubuntu-19.04-desktop-amd64-virtualbox
- my_centos-7-x86_64-libvirt
- my_centos-7-x86_64-virtualbox
- windows-server-2019-datacenter-x64-eval-libvirt
- windows-server-2019-datacenter-x64-eval-virtualbox
- windows-10-enterprise-x64-eval-libvirt
- windows-server-2016-standard-x64-eval-libvirt
- windows-server-2016-standard-x64-eval-virtualbox
- windows-server-2012_r2-standard-x64-eval-libvirt
- windows-server-2019-datacenter-x64-eval-libvirt

steps:
- uses: actions/checkout@v2

- name: Checkout submodules
shell: bash
run: |
ls -la
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Build image - ${{ matrix.stage }}
run: |
ln -sv "${PACKER_CACHE_DIR}" packer_cache
./build.sh ${{ matrix.stage }}
- name: Check the created box image - ${{ matrix.stage }}
run: ./vagrant_init_destroy_boxes.sh ${PACKER_IMAGES_OUTPUT_DIR}/${{ matrix.stage }}.box

- name: Upload box to Vagrant Cloud - ${{ matrix.stage }}
if: github.ref == 'refs/heads/master'
run: |
export BOX_VERSION=$(cat "${PACKER_CACHE_DIR}/BOX_VERSION")
echo "*** Using BOX_VERSION=${BOX_VERSION} from file: ${PACKER_CACHE_DIR}/BOX_VERSION"
./upload_box_to_vagrantup.sh ${VAGRANTUP_USER}@${PACKER_IMAGES_OUTPUT_DIR}/${{ matrix.stage }}.box
- name: Log cleanup - ${{ matrix.stage }}
run: rm -v ${LOGDIR}/${{ matrix.stage }}*

##############
# VirtualBox
##############

build-virtualbox:
name: "*"
runs-on: [self-hosted, linux, x64]
needs: [prebuild, build-libvirt]
env:
PACKER_IMAGES_OUTPUT_DIR: /var/tmp/packer-templates-images
PACKER_CACHE_DIR: /var/tmp/packer_cache
LOGDIR: /var/tmp/packer-templates-logs
VAGRANTUP_USER: peru
VAGRANTUP_ACCESS_TOKEN: ${{ secrets.VAGRANTUP_ACCESS_TOKEN }}
strategy:
max-parallel: 2
matrix:
stage:
- windows-server-2012_r2-standard-x64-eval-virtualbox
- my_windows-10-enterprise-x64-eval-libvirt
- my_centos-7-x86_64-virtualbox
- my_ubuntu-18.04-server-amd64-virtualbox
- my_windows-10-enterprise-x64-eval-virtualbox
- windows-10-enterprise-x64-eval-libvirt
- ubuntu-16.04-server-amd64-virtualbox
- ubuntu-18.04-server-amd64-virtualbox
- ubuntu-19.04-desktop-amd64-virtualbox
- windows-10-enterprise-x64-eval-virtualbox
- windows-server-2016-standard-x64-eval-virtualbox
- windows-server-2019-datacenter-x64-eval-virtualbox

steps:
- uses: actions/checkout@v2
Expand All @@ -84,7 +129,7 @@ jobs:
run: ./vagrant_init_destroy_boxes.sh ${PACKER_IMAGES_OUTPUT_DIR}/${{ matrix.stage }}.box

- name: Upload box to Vagrant Cloud - ${{ matrix.stage }}
if: github.ref == 'refs/heads/master'
if: github.event_name == 'schedule' || ( github.event_name == 'repository_dispatch' && github.event.action == 'build_release_upload' )
run: |
export BOX_VERSION=$(cat "${PACKER_CACHE_DIR}/BOX_VERSION")
echo "*** Using BOX_VERSION=${BOX_VERSION} from file: ${PACKER_CACHE_DIR}/BOX_VERSION"
Expand All @@ -94,7 +139,7 @@ jobs:
run: rm -v ${LOGDIR}/${{ matrix.stage }}*

cleanup:
needs: build
needs: build-virtualbox
name: Cleanup
runs-on: [self-hosted, linux, x64]
env:
Expand All @@ -109,9 +154,9 @@ jobs:
rm -v ${PACKER_IMAGES_OUTPUT_DIR}/*.box
rmdir -v "${PACKER_IMAGES_OUTPUT_DIR}" "${LOGDIR}" "${VAGRANT_TMP}" || true
vagrantup_check:
needs: build
name: Verify if the boxes are avaiable on the Vegrant Cloud
check-vagrantcloud:
needs: build-virtualbox
name: Verify if the boxes are avaiable on the Vagrant Cloud
runs-on: ubuntu-18.04
steps:
- name: Check the boxes at app.vagrantup.com
Expand Down

0 comments on commit 734eee1

Please sign in to comment.