use dorny version of skipping workflow jobs (#768)
## Description The current action workflow skips cause requried actions to be marked as passing until they fail, not marked as incomplete until either passed, failed, or skipped. This change should provide the latter behavior. ## Type of change - [x] 🌻 Feature ## Issue(s) * #744 ## Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
bf014f8706
commit
b739526bb5
37
.github/workflows/_filechange_checker.yml
vendored
Normal file
37
.github/workflows/_filechange_checker.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: Filechange Checker
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
outputs:
|
||||||
|
fileschanged:
|
||||||
|
description: "'true' if src/** or .github/workflows/** files have changed in the branch"
|
||||||
|
value: ${{ jobs.file-change-check.outputs.fileschanged }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
file-change-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
outputs:
|
||||||
|
fileschanged: ${{ steps.checker.outputs.fileschanged }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# only run CI tests if the src folder or workflow actions have changed
|
||||||
|
- name: Check for file changes in src/ or .github/workflows/
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: dornycheck
|
||||||
|
with:
|
||||||
|
list-files: json
|
||||||
|
filters: |
|
||||||
|
src:
|
||||||
|
- 'src/**'
|
||||||
|
actions:
|
||||||
|
- '.github/workflows/**'
|
||||||
|
- name: Check dorny for changes in specified filepaths
|
||||||
|
id: checker
|
||||||
|
if: steps.dornycheck.outputs.src == 'true' || steps.dornycheck.outputs.actions == 'true'
|
||||||
|
run: |
|
||||||
|
echo "src or workflow file changes occurred"
|
||||||
|
echo ::set-output name=fileschanged::true
|
||||||
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
@ -9,26 +9,38 @@ permissions:
|
|||||||
# required to retrieve AWS credentials
|
# required to retrieve AWS credentials
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
# cancel currently running jobs if a new version of the branch is pushed
|
||||||
|
concurrency:
|
||||||
|
group: ci-linting-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
precheck:
|
||||||
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||||
|
|
||||||
Test-Suite:
|
Test-Suite:
|
||||||
|
needs: precheck
|
||||||
environment: Testing
|
environment: Testing
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: src
|
working-directory: src
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Get values for cache paths to be used in later steps
|
# Get values for cache paths to be used in later steps
|
||||||
- id: go-cache-paths
|
- name: Local Cache Setup
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: go-cache-paths
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||||
|
|
||||||
- name: Golang Setup
|
- name: Golang Setup
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
@ -37,34 +49,38 @@ jobs:
|
|||||||
|
|
||||||
# download packages
|
# download packages
|
||||||
- name: Cache Go Mod
|
- name: Cache Go Mod
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: modcache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: cache
|
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
||||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Run go mod download
|
- name: Run go mod download
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.modcache.outputs.cache-hit != 'true'
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
# build the binary
|
# build the binary
|
||||||
- name: Cache Go build
|
- name: Cache Go build
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: gocache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: mybuild
|
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
||||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Go build
|
- name: Go build
|
||||||
if: steps.mybuild.outputs.cache-hit != 'true'
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.gocache.outputs.cache-hit != 'true'
|
||||||
run: go build -v ./...
|
run: go build -v ./...
|
||||||
|
|
||||||
# Install gotestfmt
|
# Install gotestfmt
|
||||||
- name: Set up gotestfmt
|
- name: Set up gotestfmt
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
||||||
|
|
||||||
# AWS creds
|
# AWS creds
|
||||||
- name: Configure AWS credentials from Test account
|
- name: Configure AWS credentials from Test account
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
with:
|
with:
|
||||||
role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role
|
role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role
|
||||||
@ -72,8 +88,8 @@ jobs:
|
|||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
# run the tests
|
# run the tests
|
||||||
- run: echo "Running ${{ github.repository }} integration tests."
|
|
||||||
- name: Integration Tests
|
- name: Integration Tests
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
env:
|
env:
|
||||||
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
||||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||||
@ -87,8 +103,8 @@ jobs:
|
|||||||
|
|
||||||
# Upload the original go test log as an artifact for later review.
|
# Upload the original go test log as an artifact for later review.
|
||||||
- name: Upload test log
|
- name: Upload test log
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
if: always()
|
|
||||||
with:
|
with:
|
||||||
name: test-log
|
name: test-log
|
||||||
path: /tmp/gotest.log
|
path: /tmp/gotest.log
|
||||||
|
|||||||
6
.github/workflows/docgen.yml
vendored
6
.github/workflows/docgen.yml
vendored
@ -9,10 +9,14 @@ permissions:
|
|||||||
deployments: write
|
deployments: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
precheck:
|
||||||
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||||
|
|
||||||
Generate-Markdown:
|
Generate-Markdown:
|
||||||
|
needs: precheck
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Repo Code Checkout
|
- name: Repo Code Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
7
.github/workflows/image.yml
vendored
7
.github/workflows/image.yml
vendored
@ -6,9 +6,15 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
precheck:
|
||||||
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||||
|
|
||||||
Per-SHA-Image:
|
Per-SHA-Image:
|
||||||
|
needs: precheck
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
@ -16,7 +22,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PLATFORMS: linux/amd64,linux/arm64
|
PLATFORMS: linux/amd64,linux/arm64
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
|||||||
28
.github/workflows/lint.yml
vendored
28
.github/workflows/lint.yml
vendored
@ -7,9 +7,19 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
# cancel currently running jobs if a new version of the branch is pushed
|
||||||
|
concurrency:
|
||||||
|
group: ci-linting-${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
precheck:
|
||||||
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||||
|
|
||||||
Linting:
|
Linting:
|
||||||
|
needs: precheck
|
||||||
environment: Testing
|
environment: Testing
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
@ -21,39 +31,45 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Get values for cache paths to be used in later steps
|
# Get values for cache paths to be used in later steps
|
||||||
- id: go-cache-paths
|
- name: Local Cache Setup
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: go-cache-paths
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||||
|
|
||||||
- name: Golang Setup
|
- name: Golang Setup
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
|
|
||||||
- name: Cache Go Mod
|
- name: Cache Go Mod
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: modcache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: cache
|
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: ~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Download package dependencies
|
- name: Download package dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.modcache.outputs.cache-hit != 'true'
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
- name: Cache Go build
|
- name: Cache Go build
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
|
id: gocache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: mybuild
|
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/go-build
|
path: ~/.cache/go-build
|
||||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Build for Lint
|
- name: Build for Lint
|
||||||
if: steps.mybuild.outputs.cache-hit != 'true'
|
if: needs.precheck.outputs.fileschanged == 'true' && steps.gocache.outputs.cache-hit != 'true'
|
||||||
run: go build ./...
|
run: go build ./...
|
||||||
|
|
||||||
- name: Go Lint
|
- name: Go Lint
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
uses: golangci/golangci-lint-action@v3.2.0
|
uses: golangci/golangci-lint-action@v3.2.0
|
||||||
with:
|
with:
|
||||||
version: v1.45.2
|
version: v1.45.2
|
||||||
@ -64,7 +80,9 @@ jobs:
|
|||||||
|
|
||||||
# check licenses
|
# check licenses
|
||||||
- name: Get go-licenses
|
- name: Get go-licenses
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
run: go install github.com/google/go-licenses@latest
|
run: go install github.com/google/go-licenses@latest
|
||||||
|
|
||||||
- name: Run go-licenses
|
- name: Run go-licenses
|
||||||
|
if: needs.precheck.outputs.fileschanged == 'true'
|
||||||
run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src
|
run: go-licenses check github.com/alcionai/corso/src --ignore github.com/alcionai/corso/src
|
||||||
Loading…
x
Reference in New Issue
Block a user