Skip to content

Commit b710da4

Browse files
committed
Added zig feature
1 parent a55a238 commit b710da4

File tree

14 files changed

+292
-2
lines changed

14 files changed

+292
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
feature: ["go"]
17+
feature: ["go", "zig"]
1818
runs-on: ubuntu-latest
1919
permissions:
2020
contents: read

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Below is a list with included features, click on the link for more details.
1616
| Name | Description |
1717
| --- | --- |
1818
| [go](./features/src/go/README.md) | A feature which installs Go. |
19+
| [zig](./features/src/zig/README.md) | A feature which installs Zig. |
1920

2021
## Usage
2122

build/build.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
var featureList = []string{
2323
"go",
24+
"zig",
2425
}
2526

2627
////////////////////////////////////////////////////////////
@@ -45,6 +46,7 @@ func init() {
4546
return nil
4647
})
4748

49+
////////// Go
4850
gotaskr.Task("Feature:go:Package", func() error {
4951
return packageFeature("go")
5052
})
@@ -54,6 +56,17 @@ func init() {
5456
gotaskr.Task("Feature:go:Publish", func() error {
5557
return publishFeature("go")
5658
})
59+
60+
////////// Zig
61+
gotaskr.Task("Feature:zig:Package", func() error {
62+
return packageFeature("zig")
63+
})
64+
gotaskr.Task("Feature:zig:Test", func() error {
65+
return testFeature("zig")
66+
})
67+
gotaskr.Task("Feature:zig:Publish", func() error {
68+
return publishFeature("zig")
69+
})
5770
}
5871

5972
////////////////////////////////////////////////////////////

features/src/go/NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
### System Compatibility
44

55
Debian, Ubuntu, Alpine
6+
7+
### Accessed Urls
8+
9+
Needs to access the following urls to install non-exact versions:
10+
* https://go.dev/dl/?mode=json&include=all
11+
* https://go.dev/VERSION?m=text

features/src/go/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ A feature which installs Go.
3535
### System Compatibility
3636

3737
Debian, Ubuntu, Alpine
38+
39+
### Accessed Urls
40+
41+
Needs to access the following urls to install non-exact versions:
42+
* https://go.dev/dl/?mode=json&include=all
43+
* https://go.dev/VERSION?m=text

features/src/go/installer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (c *goComponent) GetAllVersions() ([]*gover.Version, error) {
9696
if err != nil {
9797
return nil, err
9898
}
99-
var jsonData []map[string]interface{}
99+
var jsonData []map[string]any
100100
if err := json.Unmarshal(versionFileContent, &jsonData); err != nil {
101101
return nil, err
102102
}

features/src/zig/NOTES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Notes
2+
3+
### System Compatibility
4+
5+
Debian, Ubuntu, Alpine
6+
7+
### Accessed Urls
8+
9+
Needs to access the following urls to install non-exact versions:
10+
* https://ziglang.org/download/index.json

features/src/zig/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Zig (zig)
2+
3+
A feature which installs Zig.
4+
5+
## Example Usage
6+
7+
```json
8+
"features": {
9+
"ghcr.io/postfinance/devcontainer-features/zig:1.0.0": {
10+
"version": "latest",
11+
"isExactVersion": false,
12+
"downloadRegistryBase": "",
13+
"downloadRegistryPath": ""
14+
}
15+
}
16+
```
17+
18+
## Options
19+
20+
| Option | Description | Type | Default Value | Proposals |
21+
|-----|-----|-----|-----|-----|
22+
| version | The version of Zig to install. | string | latest | latest, 0.13.0, 0.12 |
23+
| isExactVersion | Whether to install the exact version specified. | boolean | false | true, false |
24+
| downloadRegistryBase | The download registry to use for Zig binaries. | string | <empty> | https://mycompany.com/artifactory/ziglang-generic-remote |
25+
| downloadRegistryPath | The download registry path to use for Zig binaries. | string | <empty> | |
26+
27+
## Notes
28+
29+
### System Compatibility
30+
31+
Debian, Ubuntu, Alpine
32+
33+
### Accessed Urls
34+
35+
Needs to access the following urls to install non-exact versions:
36+
* https://ziglang.org/download/index.json
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": "zig",
3+
"version": "1.0.0",
4+
"name": "Zig",
5+
"description": "A feature which installs Zig.",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"proposals": [
10+
"latest",
11+
"0.13.0",
12+
"0.12"
13+
],
14+
"default": "latest",
15+
"description": "The version of Zig to install."
16+
},
17+
"isExactVersion": {
18+
"type": "boolean",
19+
"default": false,
20+
"description": "Whether to install the exact version specified."
21+
},
22+
"downloadRegistryBase": {
23+
"type": "string",
24+
"default": "",
25+
"proposals": [
26+
"https://mycompany.com/artifactory/ziglang-generic-remote"
27+
],
28+
"description": "The download registry to use for Zig binaries."
29+
},
30+
"downloadRegistryPath": {
31+
"type": "string",
32+
"default": "",
33+
"description": "The download registry path to use for Zig binaries."
34+
}
35+
},
36+
"containerEnv": {
37+
"PATH": "/usr/local/zig:${PATH}"
38+
}
39+
}

features/src/zig/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
case $(uname -m) in
2+
x86_64*) ARCH=amd64 ;;
3+
arm*) ARCH=arm64 ;;
4+
*) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;;
5+
esac
6+
7+
"./installer_$ARCH" \
8+
-version="${VERSION:-"latest"}" \
9+
-isExactVersion="${IS_EXACT_VERSION:-false}" \
10+
-downloadRegistryBase="${DOWNLOAD_REGISTRY_BASE:-""}" \
11+
-downloadRegistryPath="${DOWNLOAD_REGISTRY_PATH:-""}"

0 commit comments

Comments
 (0)