Skip to content

Commit

Permalink
sync with upstream workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltol committed Sep 17, 2024
1 parent b3dbdfa commit 30cf262
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 143 deletions.
Binary file modified .github/assets/github_actions_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/assets/infracost_cloud_dashboard_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions .github/workflows/check-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
name: Check resources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/code-scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/create-docker-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create docker prerelease

on:
push:
branches: [ master ]

jobs:
build:
name: Create docker prerelease
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPOSITORY }}
tags: |
type=edge
flavor: |
latest=false
- name: Build and push Docker images
uses: docker/build-push-action@v4
id: build_push_docker
with:
context: .
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
push: true

- name: Clean Docker image
run: docker rmi ${{ steps.build_push_docker.outputs.imageid }} -f

- name: Docker meta (CI)
id: meta-ci
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPOSITORY }}
tags: |
type=edge
flavor: |
prefix=ci-
latest=false
- name: Build and push Docker images (CI)
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.ci
platforms: linux/amd64
tags: ${{ steps.meta-ci.outputs.tags }}
push: true
16 changes: 7 additions & 9 deletions .github/workflows/create-pr-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,34 @@ jobs:
- target: darwin
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod
- name: Build project
run: make ${{ matrix.target }}
- name: Upload amd64 build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.target != 'windows' }}
with:
name: ${{ matrix.target }}-amd64
path: "build/infracost-${{ matrix.target }}-amd64"
- name: Upload windows amd64 build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'windows' }}
with:
name: ${{ matrix.target }}-amd64
path: "build/infracost.exe"
- name: Upload arm64 build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.target != 'windows' }}
with:
name: ${{ matrix.target }}-arm64
path: "build/infracost-${{ matrix.target }}-arm64"
- name: Upload windows arm64 build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'windows' }}
with:
name: ${{ matrix.target }}-arm64
path: "build/infracost-arm64.exe"

31 changes: 31 additions & 0 deletions .github/workflows/create-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Upload master prerelease

on:
push:
branches: [ master ]

jobs:
build:
name: Upload master prerelease
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build project
run: |
make release
- name: Release
run: go run tools/release/main.go
env:
RELEASE_ID: "preview"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Remove build assets
run: rm -rf build
44 changes: 22 additions & 22 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Build project
run: |
Expand All @@ -27,18 +27,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Remove build assets
run: rm -rf build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPOSITORY }}
Expand All @@ -47,16 +50,20 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
id: build_push_docker
with:
context: .
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
push: true

- name: Clean Docker image
run: docker rmi ${{ steps.build_push_docker.outputs.imageid }} -f

- name: Docker meta (CI)
id: meta-ci
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPOSITORY }}
Expand All @@ -67,7 +74,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker images (CI)
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.ci
Expand All @@ -94,24 +101,17 @@ jobs:
token: ${{secrets.HOMEBREW_RELEASE_TOKEN}}
formula: infracost

update-download-redirects:
if: ${{ !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') }}
name: Upload Download Redirects
needs: build
uses: ./.github/workflows/update-download-redirects.yml
with:
version: ${{ github.ref_name }}
secrets:
AMPLIFY_APP_ID: ${{ secrets.AMPLIFY_APP_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

update-fig-autocomplete-spec:
if: ${{ !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') }}
name: Update Fig autocomplete spec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Get the new version
id: version
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/create-test-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ jobs:
name: Build and Push Docker test image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Build project
run: |
make build
- name: Build and push Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
44 changes: 29 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Check Terraform format
run: make tf_fmt_check

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2.297.0
uses: golangci/golangci-lint-action@v6.1.0
with:
version: latest
skip-pkg-cache: true
args: --timeout 3m0s
args: --timeout 5m

- name: Install Terragrunt v0.31.8
run: |
Expand All @@ -38,6 +40,18 @@ jobs:
INFRACOST_LOG_LEVEL: info
INFRACOST_TERRAFORM_CLOUD_TOKEN: ${{ secrets.TERRAFORM_CLOUD_TOKEN }}

- name: Parser benchmarks
run: make parser_benchmarks

- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
name: benchmarks
path: |
mem.out
cpu.out
trace.out
- name: Test example works ok from CLI
run: |
make run --silent ARGS="breakdown --path examples/terraform --usage-file=examples/terraform/infracost-usage.yml --format json" > infracost-output.json
Expand All @@ -61,11 +75,11 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Test (AWS)
run: make test_aws
Expand All @@ -78,11 +92,11 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Test (Google)
run: make test_google
Expand All @@ -95,11 +109,11 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod

- name: Test (Azure)
run: make test_azure
Expand Down
Loading

0 comments on commit 30cf262

Please sign in to comment.