Merge pull request #2700 from gofiber/dependabot/docker/react-router/β¦ #6268
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@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.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 |