-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.32 KB
/
Copy pathcheck-format.yml
File metadata and controls
82 lines (69 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Check Format
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DOCKERFILE: picolibc/.github/Dockerfile-check-format
IMAGE_FILE: dockerimg-check-format.tar.zst
IMAGE: picolibc-check-format
PACKAGES_FILE: picolibc/.github/check-format-packages.txt
EXTRA_FILE: picolibc/.github/check-format-files.txt
jobs:
cache-maker:
runs-on: ubuntu-latest
steps:
- name: Clone picolibc
uses: actions/checkout@v6
with:
path: picolibc
- name: Cache the Docker Image
id: cache
uses: actions/cache@v5
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
lookup-only: true
- name: Set up Docker Buildx
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/setup-buildx-action@v3
- name: Build picolibc container
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
file: .github/Dockerfile-check-format
tags: ${{ env.IMAGE }}:latest
outputs: type=docker,force-compression=true,compression=zstd,compression-level=22,dest=${{ env.IMAGE_FILE }}
check-format:
needs: cache-maker
runs-on: ubuntu-latest
steps:
- name: Clone picolibc
uses: actions/checkout@v6
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v5
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
- name: Check Formatting
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc $IMAGE bash --login -c "./.github/do-check-format"