Skip to content

Commit 79079b9

Browse files
authored
Merge pull request #108 from aminya/nala [skip ci]
fix: support using nala instead of apt
2 parents e82d38f + 17fa293 commit 79079b9

File tree

12 files changed

+142
-40
lines changed

12 files changed

+142
-40
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ Setting up a **cross-platform** environment for building and testing C++/C proje
1010

1111
`setup-cpp` is supported on many platforms. It is continuously tested on several configurations including Windows (11, 10, 2022, 2019), Linux (Ubuntu 22.04, Ubuntu 20.04, Fedora, ArchLinux), and macOS (12, 11, 10.15). `setup-cpp` is backed by unit tests for each tool and integration tests for compiling cpp projects.
1212

13-
# Features
13+
## Features
1414

1515
`setup-cpp` is **modular** and you can choose to install any of these tools:
1616

1717
| category | tools |
1818
| --------------------- | ------------------------------------------------------------ |
1919
| compiler and analyzer | llvm, gcc, msvc, vcvarsall, cppcheck, clangtidy, clangformat |
2020
| build system | cmake, ninja, meson, make, task |
21-
| package manager | vcpkg, conan, choco, brew |
21+
| package manager | vcpkg, conan, choco, brew, nala |
2222
| cache | cppcache |
2323
| documentation | doxygen, graphviz |
2424
| coverage | gcovr, opencppcoverage, kcov |
2525
| other | python, sevenzip |
2626

2727
`setup-cpp` automatically installs the dependencies above tools if needed for the selected tool (e.g., `python` is required for `conan`).
2828

29-
# Usage
29+
## Usage
3030

31-
## From Terminal
31+
### From Terminal
3232

3333
You should download the executable file or the js file (if Nodejs installed), and run it with the available options.
3434

3535
Tip: You can automate downloading using `wget`, `curl`, or other similar tools.
3636

37-
### Executable
37+
#### Executable
3838

3939
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.18.0), and run it with the available options.
4040

@@ -72,7 +72,7 @@ NOTE: On Unix systems, when `setup-cpp` is used locally or in other CI services
7272

7373
NOTE: On Unix systems, you will not need `sudo` if you are already a root user (e.g., in a GitLab runner or Docker).
7474

75-
### With Nodejs
75+
#### With Nodejs
7676

7777
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.18.0/setup_cpp.js), and run it with the available options.
7878

@@ -97,7 +97,7 @@ sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true
9797
source ~/.cpprc # activate cpp environment variables
9898
```
9999

100-
## Inside GitHub Actions
100+
### Inside GitHub Actions
101101

102102
Here is a complete cross-platform example that tests llvm, gcc, and msvc. It also uses cmake, ninja, vcpkg, and cppcheck.
103103

@@ -158,7 +158,7 @@ jobs:
158158
# ...
159159
```
160160

161-
## Inside Docker
161+
### Inside Docker
162162

163163
Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need.
164164

@@ -213,7 +213,7 @@ After build, run the following to start an interactive shell in your container
213213
docker run -it setup_cpp
214214
```
215215

216-
## Inside Docker inside GitHub Actions
216+
### Inside Docker inside GitHub Actions
217217

218218
You can use the docker file discussed in the previous section inside GitHub Actions like the following:
219219

@@ -235,7 +235,7 @@ jobs:
235235
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
236236
```
237237
238-
## Inside GitLab pipelines
238+
### Inside GitLab pipelines
239239
240240
The following gives an example for setting up a C++ environment inside GitLab pipelines.
241241
@@ -292,11 +292,11 @@ test_linux_gcc:
292292
- *test
293293
```
294294

295-
# Articles
295+
## Articles
296296

297297
[Setup-Cpp on Dev.to](https://dev.to/aminya/setup-cpp-3ia4)
298298

299-
# Usage Examples
299+
## Usage Examples
300300

301301
- [cpp_vcpkg_project project](https://github.com/aminya/cpp_vcpkg_project)
302302
- [ftxui](https://github.com/ArthurSonzogni/FTXUI)

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ inputs:
7575
sevenzip:
7676
description: "The 7z version to install."
7777
required: false
78+
nala:
79+
description: 'The nala version to install ("" or "legacy").'
80+
required: false
7881

7982
runs:
8083
using: "node12"

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ words:
4646
- msys
4747
- multilib
4848
- mxschmitt
49+
- nala
4950
- noconfirm
5051
- noprogressbar
5152
- nothrow

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/setup_cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/default_versions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ const DefaultUbuntuVersion: Record<string, Record<number, string>> = {
5555
doxygen: {
5656
20: "1.9.4",
5757
},
58+
nala: {
59+
22: "",
60+
21: "legacy",
61+
20: "legacy",
62+
18: "legacy",
63+
16: "legacy",
64+
14: "legacy",
65+
},
5866
}
5967

6068
/** Get the default version if passed true or undefined, otherwise return the version itself */

src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ import { setupKcov } from "./kcov/kcov"
4242
import { addEnv } from "./utils/env/addEnv"
4343
import { setupSevenZip } from "./sevenzip/sevenzip"
4444
import { setupGraphviz } from "./graphviz/graphviz"
45+
import { setupNala } from "./nala/nala"
4546

4647
/** The setup functions */
4748
const setups = {
49+
nala: setupNala,
4850
cmake: setupCmake,
4951
ninja: setupNinja,
5052
python: setupPython,
@@ -73,6 +75,7 @@ const setups = {
7375

7476
/** The tools that can be installed */
7577
const tools: Array<keyof typeof setups> = [
78+
"nala",
7679
"choco",
7780
"brew",
7881
"python",
@@ -372,6 +375,7 @@ All the available tools:
372375
--python
373376
--choco
374377
--brew
378+
--nala
375379
--sevenzip
376380
--graphviz
377381
`)

src/nala/__tests__/nala.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { setupNala } from "../nala"
2+
import { testBin } from "../../utils/tests/test-helpers"
3+
import { isUbuntu } from "../../utils/env/isUbuntu"
4+
5+
jest.setTimeout(300000)
6+
describe("setup-nala", () => {
7+
it("should setup nala", async () => {
8+
if (!isUbuntu()) {
9+
return
10+
}
11+
const installInfo = setupNala("", "", process.arch)
12+
await testBin("nala", ["--version"], installInfo?.binDir)
13+
})
14+
})

0 commit comments

Comments
 (0)