Reduce CI jobs being run when not needed

This commit is contained in:
Gabe Kangas
2024-07-11 11:44:23 -07:00
parent e7d90d441e
commit c4756a9a45
4 changed files with 56 additions and 4 deletions

View File

@@ -18,14 +18,25 @@ jobs:
with: with:
concurrent_skipping: 'same_content_newer' concurrent_skipping: 'same_content_newer'
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files_yaml: |
src:
- '**/*.{go,mod,sum}'
- uses: earthly/actions-setup@v1 - uses: earthly/actions-setup@v1
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with: with:
version: 'latest' # or pin to an specific version, e.g. "v0.6.10" version: 'latest' # or pin to an specific version, e.g. "v0.6.10"
- name: Earthly version - name: Earthly version
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
run: earthly --version run: earthly --version
- name: Set up QEMU - name: Set up QEMU
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
id: qemu id: qemu
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
with: with:
@@ -33,8 +44,10 @@ jobs:
platforms: all platforms: all
- uses: actions/checkout@v4 - uses: actions/checkout@v4
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
- name: Run API tests - name: Run API tests
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
uses: nick-fields/retry@v3 uses: nick-fields/retry@v3
with: with:
timeout_minutes: 10 timeout_minutes: 10

View File

@@ -27,8 +27,21 @@ jobs:
uses: fkirc/skip-duplicate-actions@v5 uses: fkirc/skip-duplicate-actions@v5
with: with:
concurrent_skipping: 'same_content_newer' concurrent_skipping: 'same_content_newer'
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
path: 'web'
files_ignore: |
static/**
web/next.config.js
files_yaml: |
src:
- '**/*.{js,ts,tsx,jsx,md}'
- name: Check out code - name: Check out code
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' }} if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' && steps.changed-files-yaml.outputs.src_any_changed == 'true' }}
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
# Make sure the actual branch is checked out when running on pull requests # Make sure the actual branch is checked out when running on pull requests
@@ -37,13 +50,13 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Install dependencies - name: Install dependencies
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' }} if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' && steps.changed-files-yaml.outputs.src_any_changed == 'true'}}
run: npm install run: npm install
- name: Publish to Chromatic - name: Publish to Chromatic
if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' }} if: ${{ github.actor != 'renovate[bot]' && github.actor != 'renovate' && steps.changed-files-yaml.outputs.src_any_changed == 'true' }}
uses: chromaui/action@v11 uses: chromaui/action@v11
# Chromatic GitHub Action options # Chromatic GitHub Action options
with: with:
workingDir: web workingDir: web

View File

@@ -18,7 +18,16 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files_yaml: |
src:
- '**/*.{go,mod,sum}'
- uses: actions/cache@v4 - uses: actions/cache@v4
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with: with:
path: | path: |
~/.cache/go-build ~/.cache/go-build
@@ -28,12 +37,14 @@ jobs:
go-test- go-test-
- name: Install go - name: Install go
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: '^1' go-version: '^1'
cache: true cache: true
- name: Run tests - name: Run tests
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
run: go test ./... run: go test ./...
test-bsds: test-bsds:
@@ -50,6 +61,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/cache@v4 - uses: actions/cache@v4
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with: with:
path: | path: |
~/.cache/go-build ~/.cache/go-build
@@ -60,9 +72,11 @@ jobs:
- name: Install go - name: Install go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with: with:
go-version: '^1' go-version: '^1'
cache: true cache: true
- name: Run tests - name: Run tests
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
run: go test ./... run: go test ./...

View File

@@ -24,8 +24,18 @@ jobs:
uses: fkirc/skip-duplicate-actions@v5 uses: fkirc/skip-duplicate-actions@v5
with: with:
concurrent_skipping: 'same_content_newer' concurrent_skipping: 'same_content_newer'
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files_yaml: |
src:
- '**/*.{go,mod,sum}'
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with: with:
go-version: '1.22' go-version: '1.22'
cache: true cache: true
@@ -43,6 +53,7 @@ jobs:
${{ runner.os }}- ${{ runner.os }}-
- name: Local stroage - name: Local stroage
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
uses: nick-fields/retry@v3 uses: nick-fields/retry@v3
with: with:
timeout_minutes: 10 timeout_minutes: 10
@@ -50,6 +61,7 @@ jobs:
command: cd test/automated/hls && ./run.sh command: cd test/automated/hls && ./run.sh
- name: S3 storage - name: S3 storage
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
uses: nick-fields/retry@v3 uses: nick-fields/retry@v3
with: with:
timeout_minutes: 10 timeout_minutes: 10