Skip to content

Commit

Permalink
Merge pull request #108 from umich-vci/update_actions
Browse files Browse the repository at this point in the history
Update actions
  • Loading branch information
adarobin authored Nov 15, 2024
2 parents 0a9b7fa + 935d8f8 commit e164810
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 63 deletions.
9 changes: 7 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# See GitHub's documentation for more information on this file:
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
# See GitHub's docs for more information on this file:
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"

# Maintain dependencies for Go modules
- package-ecosystem: "gomod"
directory: "/"
schedule:
# Check for updates to Go modules every weekday
interval: "daily"
38 changes: 23 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- 'v*'

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
-
name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
-
name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
-
name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
Expand Down
112 changes: 67 additions & 45 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,66 @@
# Terraform Provider testing workflow.
# 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: Tests

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read

# 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 project builds before running testing matrix
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
with:
version: latest

- name: Check out code into the Go module directory
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
id: go

- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Get dependencies
run: |
go mod download
- 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)
# Run acceptance tests in a matrix with Terraform CLI versions
# run acceptance tests in a matrix with Terraform core versions
# test:
# name: Terraform Provider Acceptance Tests
# name: Matrix Test
# needs: build
# runs-on: ubuntu-latest
# timeout-minutes: 15
Expand All @@ -59,25 +69,37 @@ jobs:
# matrix:
# # list whatever Terraform versions here you would like to support
# terraform:
# - '1.0.*'
# - '1.1.*'
# - '1.2.*'
# - '1.3.*'
# - '1.4.*'
# - '1.5.*'

# steps:
# - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
# - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
# with:
# go-version-file: 'go.mod'
# cache: true
# - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
# with:
# terraform_version: ${{ matrix.terraform }}
# terraform_wrapper: false
# - run: go mod download
# - env:
# TF_ACC: "1"
# run: go test -v -cover ./internal/provider/
# timeout-minutes: 10

# - name: Check out code into the Go module directory
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# - name: Set up Go
# uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
# with:
# go-version-file: 'go.mod'
# cache: true
# id: go

# - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
# with:
# terraform_version: ${{ matrix.terraform }}
# terraform_wrapper: false

# - name: Get dependencies
# run: |
# go mod download

# - name: TF acceptance tests
# timeout-minutes: 10
# env:
# TF_ACC: "1"

# # Set whatever additional acceptance test env vars here. You can
# # optionally use data from your repository secrets using the
# # following syntax:
# # SOME_VAR: ${{ secrets.SOME_VAR }}

# run: |
# go test -v -cover ./internal/provider/
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
version: 2
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down Expand Up @@ -57,4 +58,4 @@ release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
disable: true

0 comments on commit e164810

Please sign in to comment.