Skip to content

Commit 1602a22

Browse files
authored
Merge pull request #45 from joshuanianji/ci-refactor
Ci refactor
2 parents 869bd3a + ebbe15a commit 1602a22

27 files changed

+1094
-556
lines changed

.devcontainer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
33
{
44
"name": "Idris2 Dockerfiles",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
5+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
76
"features": {
87
"ghcr.io/devcontainers/features/common-utils:2": {},
98
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: "Build Base Image"
2+
description: "Builds the correct base image depending on the idris version"
3+
4+
inputs:
5+
idris-version:
6+
description: "The Idris version to build"
7+
required: false
8+
default: "latest"
9+
push:
10+
description: "Whether to push the image to Docker Hub"
11+
required: false
12+
default: false
13+
load:
14+
description: "Whether to load the image into the local Docker daemon"
15+
required: false
16+
default: false
17+
tags:
18+
description: "The tag to use for the image"
19+
required: false
20+
default: idris-base-img
21+
labels:
22+
description: "The labels to apply to the image"
23+
required: false
24+
default: ""
25+
platforms:
26+
description: "The platforms to build for"
27+
required: false
28+
default: "linux/amd64"
29+
30+
runs:
31+
using: composite
32+
steps:
33+
- name: Get Latest Idris Commit SHA
34+
id: get-sha
35+
uses: ./.github/actions/get-idris-sha
36+
37+
- name: Build Base (versioned)
38+
uses: docker/[email protected]
39+
if: ${{ inputs.idris-version != 'latest' }}
40+
with:
41+
context: .
42+
platforms: ${{ inputs.platforms }}
43+
file: base.Dockerfile
44+
build-args: |
45+
IDRIS_VERSION=${{ inputs.idris-version }}
46+
tags: ${{ inputs.tags }}
47+
load: ${{ inputs.load }}
48+
push: ${{ inputs.push }}
49+
labels: ${{ inputs.labels }}
50+
# When doing matrix builds, we need to scope the image
51+
# https://github.com/moby/buildkit/issues/2885
52+
cache-from: type=gha,scope=build-base-${{ inputs.idris-version }}
53+
cache-to: type=gha,mode=max,scope=build-base-${{ inputs.idris-version }}
54+
55+
- name: Build Base (latest)
56+
uses: docker/[email protected]
57+
if: ${{ inputs.idris-version == 'latest' }}
58+
with:
59+
context: .
60+
platforms: ${{ inputs.platforms }}
61+
file: base-sha.Dockerfile
62+
build-args: |
63+
IDRIS_VERSION=${{ inputs.idris-version }}
64+
IDRIS_SHA=${{ steps.get-sha.outputs.sha }}
65+
tags: ${{ inputs.tags }}
66+
load: ${{ inputs.load }}
67+
push: ${{ inputs.push }}
68+
labels: ${{ inputs.labels }}
69+
# When doing matrix builds, we need to scope the image
70+
# https://github.com/moby/buildkit/issues/2885
71+
cache-from: type=gha,scope=build-base-${{ inputs.idris-version }}
72+
cache-to: type=gha,mode=max,scope=build-base-${{ inputs.idris-version }}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: "Build Base Image"
2+
description: "Builds the correct base image depending on the idris version"
3+
4+
inputs:
5+
idris-lsp-version:
6+
description: "The Idris version to build"
7+
required: false
8+
default: "latest"
9+
idris-version:
10+
description: "The Idris version to build"
11+
required: false
12+
default: "latest"
13+
base-tag:
14+
description: "Tag of the base image to use. Should be from base.Dockerfile"
15+
required: true
16+
push:
17+
description: "Whether to push the image to Docker Hub"
18+
required: false
19+
default: false
20+
load:
21+
description: "Whether to load the image into the local Docker daemon"
22+
required: false
23+
default: false
24+
tags:
25+
description: "The tag to use for the image"
26+
required: false
27+
default: idris-devcontainer-img
28+
labels:
29+
description: "The labels to apply to the image"
30+
required: false
31+
default: ""
32+
platforms:
33+
description: "The platforms to build for"
34+
required: false
35+
default: "linux/amd64"
36+
37+
runs:
38+
using: composite
39+
steps:
40+
- name: Get Latest Idris Commit SHA
41+
id: get-sha
42+
uses: ./.github/actions/get-idris-sha
43+
44+
- name: Build Devcontainer (versioned)
45+
if: ${{ inputs.idris-lsp-version != 'latest' }}
46+
uses: docker/[email protected]
47+
with:
48+
context: .
49+
file: devcontainer.Dockerfile
50+
platforms: ${{ inputs.platforms }}
51+
build-args: |
52+
IDRIS_LSP_VERSION=${{ inputs.idris-lsp-version }}
53+
IDRIS_VERSION=${{ inputs.idris-version }}
54+
BASE_IMG=${{ inputs.base-tag }}
55+
tags: ${{ inputs.tags }}
56+
load: ${{ inputs.load }}
57+
push: ${{ inputs.push }}
58+
labels: ${{ inputs.labels }}
59+
cache-from: type=gha,scope=build-devcontainer-${{ inputs.idris-lsp-version }}
60+
cache-to: type=gha,mode=max,scope=build-devcontainer-${{ inputs.idris-lsp-version }}
61+
62+
- name: Build Devcontainer (latest)
63+
if: ${{ inputs.idris-lsp-version == 'latest' }}
64+
uses: docker/[email protected]
65+
with:
66+
context: .
67+
file: devcontainer-sha.Dockerfile
68+
platforms: ${{ inputs.platforms }}
69+
build-args: |
70+
IDRIS_LSP_VERSION=${{ inputs.idris-lsp-version }}
71+
IDRIS_LSP_SHA=${{ steps.get-sha.outputs.lsp-sha }}
72+
IDRIS_VERSION=${{ inputs.idris-version }}
73+
IDRIS_SHA=${{ steps.get-sha.outputs.idris-sha }}
74+
BASE_IMG=${{ inputs.base-tag }}
75+
tags: ${{ inputs.tags }}
76+
load: ${{ inputs.load }}
77+
push: ${{ inputs.push }}
78+
labels: ${{ inputs.labels }}
79+
cache-from: type=gha,scope=build-devcontainer-${{ inputs.idris-lsp-version }}
80+
cache-to: type=gha,mode=max,scope=build-devcontainer-${{ inputs.idris-lsp-version }}

.github/actions/build-image/action.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/actions/deploy-image/action.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/actions/get-idris-sha/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ outputs:
1111
value: ${{ steps.get-sha.outputs.sha }}
1212
lsp-sha:
1313
description: "The latest Idris LSP Commit SHA"
14-
value: ${{ steps.get-lsp-sha.outputs.sha }}
14+
value: ${{ steps.get-lsp-sha.outputs.lsp-sha }}
1515

1616
runs:
1717
using: composite
@@ -26,3 +26,7 @@ runs:
2626
run: |
2727
echo "name=lsp-sha::$(curl -s 'https://api.github.com/repos/idris-community/idris2-lsp/commits' | jq -r '.[0].sha')" >> $GITHUB_OUTPUT
2828
shell: bash
29+
- name: Print Output
30+
run: |
31+
echo $GITHUB_OUTPUT
32+
shell: bash

.github/actions/setup-buildx/action.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)