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
|
||||
id-token: write
|
||||
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:
|
||||
precheck:
|
||||
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||
|
||||
Test-Suite:
|
||||
needs: precheck
|
||||
environment: Testing
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: src
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# 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: |
|
||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||
|
||||
- name: Golang Setup
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
@ -37,34 +49,38 @@ jobs:
|
||||
|
||||
# download packages
|
||||
- name: Cache Go Mod
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
id: modcache
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- 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
|
||||
|
||||
# build the binary
|
||||
- name: Cache Go build
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
id: gocache
|
||||
uses: actions/cache@v3
|
||||
id: mybuild
|
||||
with:
|
||||
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- 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 ./...
|
||||
|
||||
# Install gotestfmt
|
||||
- name: Set up gotestfmt
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
|
||||
|
||||
# AWS creds
|
||||
- name: Configure AWS credentials from Test account
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role
|
||||
@ -72,8 +88,8 @@ jobs:
|
||||
aws-region: us-east-1
|
||||
|
||||
# run the tests
|
||||
- run: echo "Running ${{ github.repository }} integration tests."
|
||||
- name: Integration Tests
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
env:
|
||||
CLIENT_ID: ${{ secrets.CLIENT_ID }}
|
||||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
|
||||
@ -87,8 +103,8 @@ jobs:
|
||||
|
||||
# Upload the original go test log as an artifact for later review.
|
||||
- name: Upload test log
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: test-log
|
||||
path: /tmp/gotest.log
|
||||
|
||||
6
.github/workflows/docgen.yml
vendored
6
.github/workflows/docgen.yml
vendored
@ -9,10 +9,14 @@ permissions:
|
||||
deployments: write
|
||||
|
||||
jobs:
|
||||
precheck:
|
||||
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||
|
||||
Generate-Markdown:
|
||||
needs: precheck
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Repo Code Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
||||
7
.github/workflows/image.yml
vendored
7
.github/workflows/image.yml
vendored
@ -6,9 +6,15 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
precheck:
|
||||
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||
|
||||
Per-SHA-Image:
|
||||
needs: precheck
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@ -16,7 +22,6 @@ jobs:
|
||||
env:
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
||||
28
.github/workflows/lint.yml
vendored
28
.github/workflows/lint.yml
vendored
@ -7,9 +7,19 @@ on:
|
||||
|
||||
permissions:
|
||||
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:
|
||||
precheck:
|
||||
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@issue-744-alt
|
||||
|
||||
Linting:
|
||||
needs: precheck
|
||||
environment: Testing
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
@ -21,39 +31,45 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# 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: |
|
||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||
|
||||
- name: Golang Setup
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Cache Go Mod
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
id: modcache
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- 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
|
||||
|
||||
- name: Cache Go build
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
id: gocache
|
||||
uses: actions/cache@v3
|
||||
id: mybuild
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- 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 ./...
|
||||
|
||||
- name: Go Lint
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
uses: golangci/golangci-lint-action@v3.2.0
|
||||
with:
|
||||
version: v1.45.2
|
||||
@ -64,7 +80,9 @@ jobs:
|
||||
|
||||
# check licenses
|
||||
- name: Get go-licenses
|
||||
if: needs.precheck.outputs.fileschanged == 'true'
|
||||
run: go install github.com/google/go-licenses@latest
|
||||
|
||||
- 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
|
||||
Loading…
x
Reference in New Issue
Block a user