1name: Linux
2
3on:
4  push:
5    branches:
6      - main
7  pull_request:
8    branches:
9      - main
10
11env:
12  IMAGE_FILE: dockerimg.tar
13  IMAGE: picolibc
14  PACKAGES_FILE: picolibc/.github/packages.txt
15  EXTRA_FILE: picolibc/.github/extra-files.txt
16
17jobs:
18  cache-maker:
19    runs-on: ubuntu-latest
20    steps:
21      - name: Clone picolibc
22        uses: actions/checkout@v2
23        with:
24          path: picolibc
25
26      - name: Cache the Docker Image
27        id: cache
28        uses: actions/cache@v2
29        with:
30          path: ${{ env.IMAGE_FILE }}
31          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
32
33      - name: Set up Docker Buildx
34        if: steps.cache.outputs.cache-hit != 'true'
35        uses: docker/setup-buildx-action@v1
36
37      - name: Build picolibc container
38        if: steps.cache.outputs.cache-hit != 'true'
39        uses: docker/build-push-action@v2
40        with:
41          platforms: linux/amd64
42          file: .github/Dockerfile
43          tags: ${{ env.IMAGE }}:latest
44          outputs: type=docker,dest=${{ env.IMAGE_FILE }}
45
46