Skip to content

154. Find Minimum In Rotated Sorted Array 2 #14

154. Find Minimum In Rotated Sorted Array 2

154. Find Minimum In Rotated Sorted Array 2 #14

Workflow file for this run

name: Go Test
on:
push:
branches: [main]
pull_request:
paths:
- "**.go"
jobs:
test:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- id: set-matrix
run: |
git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
changed_dirs=$(git diff --name-only origin/${{ github.base_ref }} | grep '.go$' | xargs -I {} dirname {} | uniq | jq -R -s -c 'split("\n")[:-1] | map({"directory": .})')
echo "Changed directories: $changed_dirs"
echo "::set-output name=matrix::$changed_dirs"
build:
needs: test
runs-on: ubuntu-latest
if: needs.test.outputs.matrix != '[]'
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.test.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "^1.12.1"
- run: go test ./${{ matrix.include.directory }}