From 2254ab709e3f6b340d4962735539a9560c661b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9B=B8=E8=BD=A9?= <9570112+nauxliu@users.noreply.github.com> Date: Wed, 11 Sep 2019 22:59:58 +0800 Subject: [PATCH] Replace travis with GitHub Actions (#497) --- .github/workflows/lint.yml | 41 ++++++++++++++++++++++++++++++ .ruby-version | 2 +- .travis.yml | 52 -------------------------------------- Gemfile | 2 +- 4 files changed, 43 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0cafaed --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Lint +on: [push, pull_request] + +jobs: + validate: + name: Validate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + # - uses: actions/setup-ruby@v1 + # with: + # ruby-version: '2.4.6' + # - name: Install Kitchen-Terraform + # run: | + # gem install bundler --no-document + # bundle install + - name: Install Terraform + run: | + export TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version') + curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" + unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform + mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/ + terraform -v + - name: Validate Code + env: + AWS_REGION: 'us-east-1' + TF_VAR_region: ${AWS_REGION} + TF_WARN_OUTPUT_ERRORS: 1 + run: | + terraform init + terraform fmt -check=true + terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster" + - name: Validate Examples + run: | + for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do + cd $example + terraform init + terraform fmt -check=true + terraform validate + cd - + done diff --git a/.ruby-version b/.ruby-version index 79a6144..7bf4b6a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.4 +2.4.6 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7954f76..0000000 --- a/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -language: ruby -sudo: required -dist: trusty - -services: -- docker - -rvm: -- 2.4.4 - -env: - global: - - AWS_REGION='us-east-1' - - TF_VAR_region=${AWS_REGION} - - TF_WARN_OUTPUT_ERRORS=1 - -before_install: -- echo "before_install" - -install: -- echo "install" -- gem install bundler --no-rdoc --no-ri -- bundle install - -before_script: -- export TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version') -- curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -- unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform -- mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/ -- terraform -v - -script: -- echo 'script' -- terraform init -- terraform fmt -check=true -- terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster" -- | - for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do - cd $example - terraform init - terraform fmt -check=true - terraform validate - cd - - done -- terraform -v - -notifications: - email: - recipients: - - brandon@atscale.run - on_success: change - on_failure: change diff --git a/Gemfile b/Gemfile index 89be253..57a0c15 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -ruby '2.4.4' +ruby '2.4.6' source 'https://rubygems.org/' do gem 'awspec', '~> 1.4.2'