-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (138 loc) · 6.79 KB
/
build.yml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: build-sysroot
on:
pull_request:
paths-ignore:
- '*.md'
- '**/*.md'
- 'LICENSE*'
push:
paths-ignore:
- '*.md'
- '**/*.md'
- 'LICENSE*'
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
MORELLOIE_DOWNLOAD_URL: "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/Morello/Development%20Tools/Morello%20Instruction%20Emulator"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Parse versions
id: parse-versions
run: |
GITHUB_REF="${{ github.ref }}"
case "$GITHUB_REF" in
refs/tags/*_llvm)
VERSIONS="${GITHUB_REF#refs/tags/v}"
export MORELLOIE_VERSION="$(echo $VERSIONS | cut -d '_' -f 1)"
export MORELLO_LLVM_VERSION="$(echo $VERSIONS | cut -d '_' -f 2)"
export MUSL_VERSION="$(echo $VERSIONS | cut -d '_' -f 3)"
echo "Using morelloie version: ${MORELLOIE_VERSION}"
echo "Using morello LLVM version: ${MORELLO_LLVM_VERSION}"
echo "Using musl version: ${MUSL_VERSION}"
echo "morelloie_version=${MORELLOIE_VERSION}" >> $GITHUB_OUTPUT
echo "morello_llvm_version=${MORELLO_LLVM_VERSION}" >> $GITHUB_OUTPUT
echo "musl_version=${MUSL_VERSION}" >> $GITHUB_OUTPUT
echo "type=llvm" >> $GITHUB_OUTPUT
echo "tag=v${MORELLOIE_VERSION}_${MORELLO_LLVM_VERSION}_${MUSL_VERSION}" >> $GITHUB_OUTPUT
;;
refs/tags/*_gcc)
VERSIONS="${GITHUB_REF#refs/tags/v}"
export MORELLOIE_VERSION="$(echo $VERSIONS | cut -d '_' -f 1)"
export GCC_VERSION="$(echo $VERSIONS | cut -d '_' -f 2)"
echo "Using morelloie version: ${MORELLOIE_VERSION}"
echo "Using morello GCC version: ${GCC_VERSION}"
echo "morelloie_version=${MORELLOIE_VERSION}" >> $GITHUB_OUTPUT
echo "morello_gcc_version=${GCC_VERSION}" >> $GITHUB_OUTPUT
echo "type=gcc" >> $GITHUB_OUTPUT
echo "tag=v${MORELLOIE_VERSION}_${GCC_VERSION}" >> $GITHUB_OUTPUT
;;
esac
- name: Cache Morello IE
id: cache-morelloie
uses: actions/cache@v3
with:
key: morelloie-${{ steps.parse-versions.outputs.morelloie_version }}
path: |
./morelloie-${{ steps.parse-versions.outputs.morelloie_version }}.tgz.sh
- name: Download Morello IE
if: steps.cache-morelloie.outputs.cache-hit != 'true'
run: |
curl -fSL "${MORELLOIE_DOWNLOAD_URL}/morelloie-${{ steps.parse-versions.outputs.morelloie_version }}.tgz.sh" -o "morelloie-${{ steps.parse-versions.outputs.morelloie_version }}.tgz.sh"
- name: Set up context for building docker image
run: |
ln "morelloie-${{ steps.parse-versions.outputs.morelloie_version }}.tgz.sh" "llvm/morelloie.tgz.sh"
ln "morelloie-${{ steps.parse-versions.outputs.morelloie_version }}.tgz.sh" "gcc/morelloie.tgz.sh"
- name: Cache Morello LLVM
if: steps.parse-versions.outputs.type == 'llvm'
id: cache-morello-llvm
uses: actions/cache@v3
with:
key: morello-llvm-linux-aarch64-${{ steps.parse-versions.outputs.morello_llvm_version }}
path: |
./llvm/morello-llvm-linux-aarch64.tar.gz
- name: Download Morello LLVM
if: steps.parse-versions.outputs.type == 'llvm' && steps.cache-morello-llvm.outputs.cache-hit != 'true'
run: |
export MORELLO_LLVM_VERSION="${{ steps.parse-versions.outputs.morello_llvm_version }}"
curl -fSL "https://git.morello-project.org/morello/llvm-project-releases/-/archive/morello/linux-aarch64-release-${MORELLO_LLVM_VERSION}/llvm-project-releases-morello-linux-aarch64-release-${MORELLO_LLVM_VERSION}.tar.gz" -o "llvm/morello-llvm-linux-aarch64.tar.gz"
- name: Cache aarch64c-linux-sysroot
if: steps.parse-versions.outputs.type == 'llvm'
id: cache-aarch64c-linux-sysroot
uses: actions/cache@v3
with:
key: aarch64c-linux-sysroot-${{ steps.parse-versions.outputs.tag }}
path: |
./llvm/musl-sysroot-hybrid.tar.gz
./llvm/musl-sysroot-purecap.tar.gz
- name: Download aarch64c-linux-sysroot
if: steps.parse-versions.outputs.type == 'llvm' && steps.cache-aarch64c-linux-sysroot.outputs.cache-hit != 'true'
run: |
SYSROOT_VERSION="${{ steps.parse-versions.outputs.tag }}"
curl -fSL "https://github.com/cocoa-xu/aarch64c-linux-sysroot/releases/download/${SYSROOT_VERSION}/musl-sysroot-hybrid.tar.gz" -o "llvm/musl-sysroot-hybrid.tar.gz"
curl -fSL "https://github.com/cocoa-xu/aarch64c-linux-sysroot/releases/download/${SYSROOT_VERSION}/musl-sysroot-purecap.tar.gz" -o "llvm/musl-sysroot-purecap.tar.gz"
- name: Build and push LLVM image
if: steps.parse-versions.outputs.type == 'llvm'
uses: docker/build-push-action@v5
with:
context: llvm
file: ./llvm/Dockerfile
push: true
tags: cocoaxu/morelloie-llvm:latest,cocoaxu/morelloie-llvm:${{ steps.parse-versions.outputs.tag }}
- name: Cache Morello GCC
if: steps.parse-versions.outputs.type == 'gcc'
id: cache-morello-gcc
uses: actions/cache@v3
with:
key: morello-gcc-linux-aarch64-${{ steps.parse-versions.outputs.morello_gcc_version }}
path: |
./gcc/arm-gnu-toolchain-aarch64-aarch64-none-linux-gnu.tar.xz
- name: Download Morello GCC
if: steps.parse-versions.outputs.type == 'gcc' && steps.cache-morello-gcc.outputs.cache-hit != 'true'
run: |
export MORELLO_GCC_VERSION="${{ steps.parse-versions.outputs.morello_gcc_version }}"
export GCC_FULL_VERSION="arm-gnu-toolchain-${MORELLO_GCC_VERSION}-aarch64-aarch64-none-linux-gnu"
curl -fSL "https://developer.arm.com/-/media/Files/downloads/gnu-morello/${MORELLO_GCC_VERSION}/binrel/${GCC_FULL_VERSION}.tar.xz" -o "./gcc/arm-gnu-toolchain-aarch64-aarch64-none-linux-gnu.tar.xz"
- name: Build and push GCC image
if: steps.parse-versions.outputs.type == 'gcc'
uses: docker/build-push-action@v5
with:
context: gcc
file: ./gcc/Dockerfile
push: true
tags: cocoaxu/morelloie-gcc:latest,cocoaxu/morelloie-gcc:${{ steps.parse-versions.outputs.tag }}