Skip to content

refactor: scoping and lint warnings #771

refactor: scoping and lint warnings

refactor: scoping and lint warnings #771

Workflow file for this run

# This GitHub action runs your tests for each commit push and/or PR. Optionally
# you can turn it on using a cron schedule for regular testing.
name: Test
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'
# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
# we recommend testing at a regular interval not necessarily tied to code changes. This will
# ensure you are alerted to something breaking due to an API change, even if the code did not
# change.
# schedule:
# - cron: '0 13 * * *'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Get dependencies
run: go mod download
- name: Build
run: go build -v .
generate:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Generate
run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
remotehost:
name: Build remote host image
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
packages: write
steps:
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v6
with:
context: tests
push: true
tags: ghcr.io/tenstad/remotehost:${{ github.sha }}
# run acceptance tests in a matrix with Terraform core versions
test:
name: Matrix Test
needs:
- build
- remotehost
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.12.*'
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
services:
remotehost:
image: ghcr.io/tenstad/remotehost:${{ github.sha }}
remotehost2:
image: ghcr.io/tenstad/remotehost:${{ github.sha }}
container:
image: golang:1.22
steps:
- name: Install unzip
run: apt-get update && apt-get install -y unzip
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: TF acceptance tests
timeout-minutes: 10
env:
TF_ACC: "1"
run: ./tests/test.sh