Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
GitHub Actions rewritten + necessary code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Dec 31, 2019
1 parent 3ff3cf3 commit 8a02584
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 115 deletions.
201 changes: 89 additions & 112 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,144 +1,121 @@
name: "vuepress-build"
name: build-test

on:
pull_request:
types: [opened, synchronize]
push:
branches: [master]

env:
EXCLUDE_WEB_PAGES: "(mylabs.dev|localhost)"

jobs:
terraform-checks:
name: "Terraform checks"
name: Terraform checks
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: "Install Terraform"
run: |
export TERRAFORM_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
curl --silent --location https://releases.hashicorp.com/terraform/${TERRAFORM_LATEST_VERSION}/terraform_${TERRAFORM_LATEST_VERSION}_linux_amd64.zip --output /tmp/terraform_linux_amd64.zip
sudo unzip -q -o /tmp/terraform_linux_amd64.zip -d /usr/local/bin/
- name: "Generate ssh key if needed"
run: |
install -m 0700 -d $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -q -N ""
- name: "Fill terraform variables with test data"
run: |
cat > terraform.tfvars << EOF
openstack_instance_image_name = "test"
openstack_password = "test"
openstack_tenant_name = "test"
openstack_user_domain_name = "test"
openstack_user_name = "test"
openstack_auth_url = "test"
openstack_instance_flavor_name = "test"
EOF
- name: "Run terraform checks"
run: |
terraform init -var-file=terraform.tfvars terrafrom/openstack
terraform validate -var-file=terraform.tfvars terrafrom/openstack
- uses: actions/checkout@v2

- name: Install Terraform
run: |
export TERRAFORM_LATEST_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
curl --silent --location https://releases.hashicorp.com/terraform/${TERRAFORM_LATEST_VERSION}/terraform_${TERRAFORM_LATEST_VERSION}_linux_amd64.zip --output /tmp/terraform_linux_amd64.zip
sudo unzip -q -o /tmp/terraform_linux_amd64.zip -d /usr/local/bin/
- name: Generate ssh key if needed
run: |
install -m 0700 -d $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -q -N ""
- name: Fill terraform variables with test data
run: |
cat > terraform.tfvars << EOF
openstack_instance_image_name = "test"
openstack_password = "test"
openstack_tenant_name = "test"
openstack_user_domain_name = "test"
openstack_user_name = "test"
openstack_auth_url = "test"
openstack_instance_flavor_name = "test"
EOF
- name: Run terraform checks
run: |
terraform init -var-file=terraform.tfvars terrafrom/openstack
terraform validate -var-file=terraform.tfvars terrafrom/openstack
command-check:
name: "Command check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Update repositories"
run: sudo apt update
- name: Update repositories
run: sudo apt update

- name: "Run tests"
run: |
sudo apt install -y pv siege
tests/ci_test.sh
- name: Run tests
run: |
sudo apt install -y pv siege
tests/ci_test.sh
markdown-lint-check:
name: "Markdown lint check"
markdownlint-check:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/checkout@v2

- name: "Install markdownlint-cli"
run: npm install -g markdownlint-cli

- 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: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v1.1.1
with:
files: .
config_file: .markdownlint.yml

markdown-spell-check:
name: "Markdown spell check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install markdown-spellcheck"
run: npm install -g markdown-spellcheck
- name: Install markdown-spellcheck
run: npm install -g markdown-spellcheck

- name: "Run mdspell"
run: mdspell '**/*.md' '!**/node_modules/**/*.md' --ignore-numbers --ignore-acronyms --report --en-gb
- name: Run mdspell
run: find . -type f -name "*.md" -exec mdspell --ignore-numbers --ignore-acronyms --report --en-gb {} \;

vuepress-build:
name: "VuePress build"
vuepress-build-check-deploy:
runs-on: ubuntu-18.04
needs:
- markdown-lint-check
- markdownlint-check
- markdown-spell-check

steps:
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install VuePress and build the document"
run: |
npm install
npm run build
cp LICENSE docs/.vuepress/dist
ln -s docs/.vuepress/dist ${GITHUB_REPOSITORY##*/}
sed -e "s@(lab-@(https://github.com/${GITHUB_REPOSITORY}/tree/master/docs/lab-@" -e 's@.\/.vuepress\/public\/@./@' docs/README.md > docs/.vuepress/dist/README.md
- name: "Check links"
run: |
echo "127.0.0.1 ${GITHUB_REPOSITORY%/*}.github.io" | sudo tee -a /etc/hosts
curl -s https://getcaddy.com | bash -s personal
cat > Caddyfile << EOF
https://${GITHUB_REPOSITORY%/*}.github.io
tls self_signed
EOF
sudo caddy -quiet &
go get -u github.com/raviqqe/muffet
~/go/bin/muffet --concurrency=10 --skip-tls-verification --exclude "${EXCLUDE_WEB_PAGES}" https://${GITHUB_REPOSITORY%/*}.github.io/${GITHUB_REPOSITORY##*/}
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.8.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs/.vuepress/dist
with:
emptyCommits: false
forceOrphan: true
- uses: actions/checkout@v2

- name: Install Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install VuePress and build the document
run: |
npm install
npm run build
cp LICENSE docs/.vuepress/dist
sed -e "s@(part-@(https://github.com/${GITHUB_REPOSITORY}/tree/master/docs/part-@" -e 's@.\/.vuepress\/public\/@./@' docs/README.md > docs/.vuepress/dist/README.md
- name: Check broken links
env:
INPUT_URL: https://${{ github.event.repository.owner.name }}.github.io/${{ github.event.repository.name }}
INPUT_PAGES_PATH: .
INPUT_CMD_PARAMS: --buffer-size=8192 --concurrency=10 --skip-tls-verification --exclude=(mylabs.dev|localhost)
run: |
ln -s docs/.vuepress/dist ${{ github.event.repository.name }}
wget -qO- https://raw.githubusercontent.com/ruzickap/action-broken-link-checker/v1/entrypoint.sh | bash
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.8.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs/.vuepress/dist
with:
forceOrphan: true
15 changes: 15 additions & 0 deletions .github/workflows/periodic-broken-links-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: periodic-broken-links-check

on:
schedule:
- cron: '8 8 * * 2'

jobs:
broken-link-checker:
runs-on: ubuntu-18.04
steps:
- name: Broken link checker
run: |
export INPUT_URL="https://${GITHUB_REPOSITORY%/*}.github.io/${GITHUB_REPOSITORY##*/}"
export INPUT_CMD_PARAMS="--buffer-size=8192 --concurrency=10 --exclude=(mylabs.dev|localhost)"
wget -qO- https://raw.githubusercontent.com/ruzickap/action-broken-link-checker/v1/entrypoint.sh | bash
25 changes: 25 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: yamllint

on:
pull_request:
types: [opened, synchronize]
paths:
- '**.yml'
- '**.yaml'
push:
paths:
- '**.yml'
- '**.yaml'
branches:
- master

jobs:
yamllint-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: yamllint
uses: ibiqlik/action-yamllint@master
with:
file_or_dir: .
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD013:
code_blocks: false
tables: false
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 80
level: warning
6 changes: 3 additions & 3 deletions files/fluentd-istio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ metadata:
spec:
match: "true" # match for all requests
actions:
- handler: handler.fluentd
instances:
- newlog.logentry
- handler: handler.fluentd
instances:
- newlog.logentry

0 comments on commit 8a02584

Please sign in to comment.