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

Switch CI to Github Actions #320

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/Dockerfile.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM fpco/pid1:18.04

# Install required Ubuntu packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install Terraform
ARG TERRAFORM_VERSION=0.12.24
RUN curl -Lo terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
&& unzip terraform.zip -d /usr/local/bin \
&& terraform --version

# Install Terraform Lint TFLint
ARG TFLINT_VERSION=v0.9.1
RUN curl -Lo tflint.zip https://github.com/wata727/tflint/releases/download/${TFLINT_VERSION}/tflint_linux_amd64.zip \
&& unzip tflint.zip -d /usr/local/bin \
&& tflint --version
23 changes: 23 additions & 0 deletions .github/workflows/lint-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build lint image

on:
push:
branches: [lint-image]

jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Log into Github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Build lint image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/lint:$GITHUB_SHA
docker build .github/workflows -f .github/workflows/Dockerfile.lint --tag $IMAGE_ID
docker push $IMAGE_ID
echo Pushed new lint image $IMAGE_ID
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on: [push, pull_request]

jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Log into Github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Lint
run: |
docker run -v $(pwd):/src --rm docker.pkg.github.com/fpco/terraform-aws-foundation/lint:bdae808b0d523c6f93c4c477c87924875f0ec0a4 bash -c "cd /src && bash ./scripts/ci/tfinit.sh && bash ./scripts/ci/tflint.sh"