-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
187 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,101 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- '**.md' | ||
- '*.json' | ||
- '.github/**' | ||
- 'ansible/**' | ||
- .spelling | ||
- package-lock.json | ||
- package.json | ||
schedule: | ||
- cron: '0 2 1 * *' | ||
|
||
jobs: | ||
markdown-lint-check: | ||
name: Markdown lint and spell check | ||
runs-on: ubuntu-18.04 | ||
prebuild: | ||
name: Prebuild actions | ||
runs-on: [self-hosted, linux, x64] | ||
env: | ||
PACKER_CACHE_DIR: /var/tmp/packer_cache | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install Node.js 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Install markdownlint-cli | ||
run: npm install -g markdownlint-cli | ||
|
||
- name: Install markdown-spellcheck | ||
run: npm install -g markdown-spellcheck | ||
|
||
- name: Create markdownlint configuration file | ||
run: | | ||
echo "{ MD013: { code_blocks: false } }" > /tmp/markdownlint_config.json | ||
- name: Run markdownlint | ||
run: find . -path ./node_modules -prune -o -name "*.md" -print0 | xargs -t -0 markdownlint -c /tmp/markdownlint_config.json | ||
|
||
- name: Run mdspell | ||
run: mdspell '**/*.md' '!**/node_modules/**/*.md' --ignore-numbers --ignore-acronyms --report --en-gb | ||
|
||
validate-packer-templates: | ||
name: Validate Packer templates | ||
runs-on: ubuntu-18.04 | ||
- name: Create Packer cache directory if not already exists | ||
run: test -d /var/tmp/packer_cache || mkdir -v /var/tmp/packer_cache | ||
|
||
- name: Set global BOX_VERSION variable | ||
run: echo "::set-env name=BOX_VERSION::${BOX_VERSION:-$(date +%Y%m%d).01}" | ||
|
||
build: | ||
name: "*" | ||
runs-on: [self-hosted, linux, x64] | ||
env: | ||
# BOX_VERSION: "20190608.01" | ||
# DOCKER_COMMAND: docker | ||
PACKER_IMAGES_OUTPUT_DIR: /var/tmp/packer-templates-images | ||
LOGDIR: /var/tmp/packer-templates-logs | ||
VAGRANTUP_USER: peru | ||
# PACKER_RUN_TIMEOUT: 18000 | ||
# USE_DOCKERIZED_PACKER: "true" | ||
# PACKER_LOG: 1 | ||
# VAGRANT_LOG: info | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
stage: | ||
- my_ubuntu-18.04-server-amd64-libvirt | ||
- my_ubuntu-18.04-server-amd64-virtualbox | ||
- 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-server-2016-standard-x64-eval-libvirt | ||
- windows-server-2016-standard-x64-eval-virtualbox | ||
- windows-server-2012_r2-standard-x64-eval-libvirt | ||
- windows-server-2012_r2-standard-x64-eval-virtualbox | ||
- my_windows-10-enterprise-x64-eval-libvirt | ||
- my_windows-10-enterprise-x64-eval-virtualbox | ||
- windows-10-enterprise-x64-eval-libvirt | ||
- windows-10-enterprise-x64-eval-virtualbox | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Download Packer | ||
run: | | ||
PACKER_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r -M '.current_version') | ||
curl -s https://releases.hashicorp.com/packer/${PACKER_LATEST_VERSION}/packer_${PACKER_LATEST_VERSION}_linux_amd64.zip --output /tmp/packer_linux_amd64.zip | ||
sudo unzip -o /tmp/packer_linux_amd64.zip -d /usr/local/bin/ | ||
- name: Check packer templates | ||
run: | | ||
IFS=$'\n' | ||
for FILE in *.json; do | ||
echo "*** $FILE" | ||
for PACKER_VALIDATE_RUN in $(awk -F\" '/"_comment"/ { gsub("packer build","packer validate",$4); print $4 }' $FILE); do | ||
echo "* $PACKER_VALIDATE_RUN" | ||
eval "$PACKER_VALIDATE_RUN" | ||
done | ||
done | ||
- uses: actions/checkout@v1 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build image - ${{ matrix.stage }} | ||
run: | | ||
echo "*** ${BOX_VERSION} | ${{ matrix.stage }}" | ||
ln -sv /var/tmp/packer_cache packer_cache | ||
./build.sh ${{ matrix.stage }} | ||
./vagrant_init_destroy_boxes.sh ${PACKER_IMAGES_OUTPUT_DIR}/${{ matrix.stage }}.box | ||
./upload_box_to_vagrantup.sh ${VAGRANTUP_USER}@${PACKER_IMAGES_OUTPUT_DIR}/${{ matrix.stage }}.box | ||
rm -v ${LOGDIR}/${{ matrix.stage }}* | ||
cleanup: | ||
needs: build | ||
name: Cleanup | ||
runs-on: [self-hosted, linux, x64] | ||
env: | ||
PACKER_IMAGES_OUTPUT_DIR: /var/tmp/packer-templates-images | ||
LOGDIR: /var/tmp/packer-templates-logs | ||
VAGRANT_TMP: /var/tmp/vagrant_init_destroy_boxes | ||
steps: | ||
- name: Cleanup | ||
run: | | ||
rm -v ${PACKER_IMAGES_OUTPUT_DIR}/*.box | ||
rmdir -v $PACKER_IMAGES_OUTPUT_DIR $LOGDIR $VAGRANT_TMP || true | ||
verify-boxes-vagrant-cloud: | ||
vagrantup_check: | ||
needs: build | ||
name: Verify if the boxes are avaiable on the Vegrant Cloud | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Check the boxes at app.vagrantup.com | ||
run: | | ||
for NAME in ubuntu-{18.10,18.04}-desktop-amd64 ubuntu-{18.04,16.04,14.04}-server-amd64 my_ubuntu-{18.04,16.04}-server-amd64 my_centos-7-x86_64 my_windows-10-enterprise-x64-eval windows-{server-{{2016,2012_r2}-standard,2019-datacenter},10-enterprise}-x64-eval; do | ||
for VAGRANT_PROVIDER in virtualbox libvirt; do | ||
CURRENT_VERSION=$(curl -s https://app.vagrantup.com/api/v1/box/peru/$NAME | jq -r ".current_version.version") | ||
URL="https://app.vagrantup.com/peru/boxes/$NAME/versions/$CURRENT_VERSION/providers/$VAGRANT_PROVIDER.box" | ||
echo "*** $URL" | ||
curl -L --fail --silent --head --output /dev/null "$URL" || ( echo "* Failed... ^^^" && exit 1 ) | ||
- name: Check the boxes at app.vagrantup.com | ||
run: | | ||
for NAME in ubuntu-{18.10,18.04}-desktop-amd64 ubuntu-{18.04,16.04,14.04}-server-amd64 my_ubuntu-{18.04,16.04}-server-amd64 my_centos-7-x86_64 my_windows-10-enterprise-x64-eval windows-{server-{{2016,2012_r2}-standard,2019-datacenter},10-enterprise}-x64-eval; do | ||
for VAGRANT_PROVIDER in virtualbox libvirt; do | ||
CURRENT_VERSION=$(curl -s https://app.vagrantup.com/api/v1/box/peru/$NAME | jq -r ".current_version.version") | ||
URL="https://app.vagrantup.com/peru/boxes/$NAME/versions/$CURRENT_VERSION/providers/$VAGRANT_PROVIDER.box" | ||
echo "*** $URL" | ||
curl -L --fail --silent --head --output /dev/null "$URL" || ( echo "* Failed... ^^^" && exit 1 ) | ||
done | ||
done | ||
done | ||
check-ansible-playbooks: | ||
name: Verify Ansible playbooks | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install ansible and ansible-lint | ||
run: | | ||
sudo pip install ansible ansible-lint | ||
- name: Test Ansible plabooks | ||
run: | | ||
ansible-playbook -i 'localhost,' --syntax-check ansible/*.yml | ||
ansible-lint -x 204,403 ansible/*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: checks | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- '**.md' | ||
- '*.json' | ||
- '.github/**' | ||
- 'ansible/**' | ||
- .spelling | ||
- package-lock.json | ||
- package.json | ||
|
||
jobs: | ||
markdown-lint-check: | ||
name: Markdown lint and spell check | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install Node.js 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Install markdownlint-cli | ||
run: npm install -g markdownlint-cli | ||
|
||
- name: Install markdown-spellcheck | ||
run: npm install -g markdown-spellcheck | ||
|
||
- name: Create markdownlint configuration file | ||
run: | | ||
echo "{ MD013: { code_blocks: false } }" > /tmp/markdownlint_config.json | ||
- name: Run markdownlint | ||
run: find . -path ./node_modules -prune -o -name "*.md" -print0 | xargs -t -0 markdownlint -c /tmp/markdownlint_config.json | ||
|
||
- name: Run mdspell | ||
run: mdspell '**/*.md' '!**/node_modules/**/*.md' --ignore-numbers --ignore-acronyms --report --en-gb | ||
|
||
validate-packer-templates: | ||
name: Validate Packer templates | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Download Packer | ||
run: | | ||
PACKER_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r -M '.current_version') | ||
curl -s https://releases.hashicorp.com/packer/${PACKER_LATEST_VERSION}/packer_${PACKER_LATEST_VERSION}_linux_amd64.zip --output /tmp/packer_linux_amd64.zip | ||
sudo unzip -o /tmp/packer_linux_amd64.zip -d /usr/local/bin/ | ||
- name: Check packer templates | ||
run: | | ||
IFS=$'\n' | ||
for FILE in *.json; do | ||
echo "*** $FILE" | ||
for PACKER_VALIDATE_RUN in $(awk -F\" '/"_comment"/ { gsub("packer build","packer validate",$4); print $4 }' $FILE); do | ||
echo "* $PACKER_VALIDATE_RUN" | ||
eval "$PACKER_VALIDATE_RUN" | ||
done | ||
done | ||
verify-boxes-vagrant-cloud: | ||
name: Verify if the boxes are avaiable on the Vegrant Cloud | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Check the boxes at app.vagrantup.com | ||
run: | | ||
for NAME in ubuntu-{18.10,18.04}-desktop-amd64 ubuntu-{18.04,16.04,14.04}-server-amd64 my_ubuntu-{18.04,16.04}-server-amd64 my_centos-7-x86_64 my_windows-10-enterprise-x64-eval windows-{server-{{2016,2012_r2}-standard,2019-datacenter},10-enterprise}-x64-eval; do | ||
for VAGRANT_PROVIDER in virtualbox libvirt; do | ||
CURRENT_VERSION=$(curl -s https://app.vagrantup.com/api/v1/box/peru/$NAME | jq -r ".current_version.version") | ||
URL="https://app.vagrantup.com/peru/boxes/$NAME/versions/$CURRENT_VERSION/providers/$VAGRANT_PROVIDER.box" | ||
echo "*** $URL" | ||
curl -L --fail --silent --head --output /dev/null "$URL" || ( echo "* Failed... ^^^" && exit 1 ) | ||
done | ||
done | ||
check-ansible-playbooks: | ||
name: Verify Ansible playbooks | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install ansible and ansible-lint | ||
run: | | ||
sudo pip install ansible ansible-lint | ||
- name: Test Ansible plabooks | ||
run: | | ||
ansible-playbook -i 'localhost,' --syntax-check ansible/*.yml | ||
ansible-lint -x 204,403 ansible/*.yml |