github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/pkg/cataloger/githubactions/test-fixtures/composite-action.yaml (about) 1 name: "Bootstrap" 2 description: "Bootstrap all tools and dependencies" 3 inputs: 4 go-version: 5 description: "Go version to install" 6 required: true 7 default: "1.21.x" 8 use-go-cache: 9 description: "Restore go cache" 10 required: true 11 default: "true" 12 cache-key-prefix: 13 description: "Prefix all cache keys with this value" 14 required: true 15 default: "831180ac25" 16 build-cache-key-prefix: 17 description: "Prefix build cache key with this value" 18 required: true 19 default: "f8b6d31dea" 20 bootstrap-apt-packages: 21 description: "Space delimited list of tools to install via apt" 22 default: "libxml2-utils" 23 24 runs: 25 using: "composite" 26 steps: 27 - uses: actions/setup-go@v4 28 with: 29 go-version: ${{ inputs.go-version }} 30 31 - name: Restore tool cache 32 id: tool-cache 33 uses: actions/cache@v3 34 with: 35 path: ${{ github.workspace }}/.tmp 36 key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-tool-${{ hashFiles('Makefile') }} 37 38 # note: we need to keep restoring the go mod cache before bootstrapping tools since `go install` is used in 39 # some installations of project tools. 40 - name: Restore go module cache 41 id: go-mod-cache 42 if: inputs.use-go-cache == 'true' 43 uses: actions/cache@v3 44 with: 45 path: | 46 ~/go/pkg/mod 47 key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }} 48 restore-keys: | 49 ${{ inputs.cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}- 50 51 - name: (cache-miss) Bootstrap project tools 52 shell: bash 53 if: steps.tool-cache.outputs.cache-hit != 'true' 54 run: make bootstrap-tools 55 56 - name: Restore go build cache 57 id: go-cache 58 if: inputs.use-go-cache == 'true' 59 uses: actions/cache@v3 60 with: 61 path: | 62 ~/.cache/go-build 63 key: ${{ inputs.cache-key-prefix }}-${{ inputs.build-cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }} 64 restore-keys: | 65 ${{ inputs.cache-key-prefix }}-${{ inputs.build-cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}- 66 67 - name: (cache-miss) Bootstrap go dependencies 68 shell: bash 69 if: steps.go-mod-cache.outputs.cache-hit != 'true' && inputs.use-go-cache == 'true' 70 run: make bootstrap-go 71 72 - name: Install apt packages 73 if: inputs.bootstrap-apt-packages != '' 74 shell: bash 75 run: | 76 DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y ${{ inputs.bootstrap-apt-packages }} 77 78 - name: Create all cache fingerprints 79 shell: bash 80 run: make fingerprints 81