chore(deps): update golang:1.21.1 docker digest to 19600fd - autoclosed #5292
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build GoFiber Recipes | |
on: | |
push: | |
branches: | |
- master | |
- main | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
branches: | |
- '*' | |
paths-ignore: | |
- "**.md" | |
jobs: | |
builds: | |
strategy: | |
matrix: | |
go-version: | |
- oldstable | |
- stable | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history so diffs can be performed | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Get directories to process | |
id: get_dirs | |
shell: bash | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
# Get the changed directories for the entire pull request | |
changed_dirs=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | awk -F'/' '{print $1}' | sort -u | tr '\n' ' ') | |
else | |
# For master branch, process all directories with go.mod | |
changed_dirs=$(find . -name go.mod -exec dirname {} \; | tr '\n' ' ') | |
fi | |
echo "changed_dirs<<EOF" >> $GITHUB_ENV | |
echo "${changed_dirs}" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Run go vet for changed directories | |
run: | | |
for dir in ${{ env.changed_dirs }}; do | |
echo "Running go vet in directory: ${dir}" | |
if [ -f "${dir}/go.mod" ]; then | |
(cd $dir; go vet ./...); | |
fi | |
done | |
- name: Run go build for changed directories | |
run: | | |
for dir in ${{ env.changed_dirs }}; do | |
echo "Running go build in directory: ${dir}" | |
if [ -f "${dir}/go.mod" ]; then | |
(cd $dir; go build -race ./...); | |
fi | |
done |