Skip to content

Phase7

Phase7 #3

Workflow file for this run

name: Terrap-Tests
on:
pull_request:
branches: [ "main" ]
paths:
- "*.go"
- "*/*.go"
- "*/*/*.go"
defaults:
run:
working-directory: ./
env:
PACKAGE_NAME: github.com/sirrend/terrap-cli
jobs:
go-setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Clean package environment
run: go mod tidy
test:
needs: go-setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: look for changed packages
run: git diff --name-only origin/main HEAD | grep internal > changed_packages || true #git show --name-only --oneline | tail -n +2
- name: Iterate over uniq files only
run: |
touch ./temp
while read line; do
dirname $line | sed 's/^.*internal/internal/' >> ./temp
done < changed_packages
cat ./temp | uniq > changed_packages
- name: Print changed packages
run: cat changed_packages
- name: Run all tests
run: go test ./...