Skip to content

Commit 7871db6

Browse files
committed
Adds GHC compilation CI stage
1 parent 5755cea commit 7871db6

File tree

3 files changed

+72
-8
lines changed

3 files changed

+72
-8
lines changed

.github/workflows/ghc.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: "GHC images"
2+
3+
on:
4+
# FIXME: Remove this before merging!
5+
# pull_request: { branches: [ "master" ] }
6+
# push: { branches: [ "release" ] }
7+
8+
env:
9+
alpine_ver: "3.14"
10+
11+
jobs:
12+
build:
13+
runs-on: "ubuntu-20.04"
14+
15+
strategy:
16+
matrix:
17+
ghc_ver: [ "8.10.7" ]
18+
numeric: [ "gmp" ]
19+
20+
steps:
21+
- name: "Check this repository out."
22+
uses: "actions/checkout@v2"
23+
24+
- name: "Pull `ghcup` image."
25+
run: |
26+
buildah pull docker://ghcr.io/jkachmar/ghcup
27+
28+
- name: "Compile GHC and publish an image from the resulting container."
29+
id: "build-image"
30+
run: |
31+
image_id=$(
32+
./ghc/builder.sh \
33+
-a "${{ env.alpine_ver }}" \
34+
-g "${{ matrix.ghc_ver }}" \
35+
-n "${{ matrix.numeric }}" \
36+
| tail -n 1
37+
)
38+
39+
image_name=$(
40+
buildah images --format "{{.Name}}" ${image_id}
41+
)
42+
# NOTE: This parameter expansion drops the leading `localhost/` that
43+
# `buildah` (and other OCI tools) prepend to local image names.
44+
echo "::set-output name=image_name::${image_name#*/}"
45+
46+
image_tags=$(
47+
buildah images --format "{{.Tag}}" ${image_id}
48+
)
49+
echo "::set-output name=image_tags::${image_tags}"
50+
51+
- name: "Push compiled GHC image to the GitHub Container Registry."
52+
id: "push-to-ghcr"
53+
uses: "redhat-actions/push-to-registry@v2"
54+
with:
55+
image: "${{ steps.build-image.outputs.image_name }}"
56+
tags: "${{ steps.build-image.outputs.image_tags }}"
57+
registry: "ghcr.io/${{ github.repository_owner }}"
58+
username: "${{ github.actor }}"
59+
password: "${{ github.token }}"
60+
61+
- name: "Print image URL."
62+
run: |
63+
echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}"

.github/workflows/ghcup.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: "`ghcup` image"
22

3+
# FIXME: Re-enable this workflow before merging!
34
on:
45
# FIXME: Remove this before merging!
56
pull_request: { branches: [ "master" ] }
@@ -16,8 +17,8 @@ jobs:
1617
- name: "Check this repository out."
1718
uses: "actions/checkout@v2"
1819

19-
- name: "Build `ghcup` image."
20-
id: "build-ghcup-image"
20+
- name: "Download `ghcup` and publish an image containing it."
21+
id: "build-image"
2122
run: |
2223
image_id=$(
2324
./ghcup/builder.sh \
@@ -29,7 +30,6 @@ jobs:
2930
image_name=$(
3031
buildah images --format "{{.Name}}" ${image_id}
3132
)
32-
3333
# NOTE: This parameter expansion drops the leading `localhost/` that
3434
# `buildah` (and other OCI tools) prepend to local image names.
3535
echo "::set-output name=image_name::${image_name#*/}"
@@ -40,15 +40,15 @@ jobs:
4040
echo "::set-output name=image_tags::${image_tags}"
4141
4242
- name: "Push `ghcup` image to the GitHub Container Registry"
43-
id: "push-ghcup-to-ghcr"
43+
id: "push-to-ghcr"
4444
uses: "redhat-actions/push-to-registry@v2"
4545
with:
46-
image: "${{ steps.build-ghcup-image.outputs.image_name }}"
47-
tags: "${{ steps.build-ghcup-image.outputs.image_tags }}"
46+
image: "${{ steps.build-image.outputs.image_name }}"
47+
tags: "latest ${{ steps.build-image.outputs.image_tags }}"
4848
registry: "ghcr.io/${{ github.repository_owner }}"
4949
username: "${{ github.actor }}"
5050
password: "${{ github.token }}"
5151

5252
- name: "Print image URL."
5353
run: |
54-
echo "Image pushed to ${{ steps.push-ghcup-to-ghcr.outputs.registry-paths }}"
54+
echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}"

policy.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"default": [{"type": "reject"}],
33
"transports": {
44
"docker": {
5-
"docker.io/library/alpine": [{"type": "insecureAcceptAnything"}]
5+
"docker.io/library/alpine": [{"type": "insecureAcceptAnything"}],
6+
"ghcr.io/jkachmar/ghcup": [{"type": "insecureAcceptAnything"}]
67
},
78
"dir": {
89
"": [{"type": "insecureAcceptAnything"}]

0 commit comments

Comments
 (0)