Skip to content

Commit 258789e

Browse files
authored
Merge pull request #1030 from per1234/fix-macos
Use versions of Task with Apple Silicon builds in tests
2 parents 4158d2b + 63fd9f4 commit 258789e

File tree

3 files changed

+51
-25
lines changed

3 files changed

+51
-25
lines changed

.github/workflows/test-integration.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ jobs:
5454
version:
5555
- input: 2.x
5656
expected: "Task version: 2.8.1"
57-
- input: 2.8.x
58-
expected: "Task version: 2.8.1"
59-
- input: 3.4.1
60-
expected: "Task version: 3.4.1"
57+
- input: 3.36.x
58+
expected: "Task version: v3.36.0 (h1:XVJ5hQ5hdzTAulHpAGzbUMUuYr9MUOEQFOFazI3hUsY=)"
59+
- input: 3.37.2
60+
expected: "Task version: v3.37.2 (h1:Jwgvo+2vX79Fu+44xPxVKC5DIkUE89QeDjN2tmYaQzA=)"
61+
62+
exclude:
63+
# The macos-latest runner is an Apple Silicon machine, but Task 2.x is only available for x86 on macOS, which
64+
# would cause a spurious test failure: "Unexpected HTTP response: 404"
65+
- runs-on: macos-latest
66+
version:
67+
input: 2.x
68+
expected: "Task version: 2.8.1"
6169

6270
steps:
6371
- name: Checkout repository

__tests__/main.test.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ describe("installer tests", () => {
4343
});
4444

4545
it("Downloads version of Task if no matching version is installed", async () => {
46-
await installer.getTask("2.6.0", "");
47-
const taskDir = path.join(toolDir, "task", "2.6.0", os.arch());
46+
await installer.getTask("3.37.1", "");
47+
const taskDir = path.join(toolDir, "task", "3.37.1", os.arch());
4848

4949
expect(fs.existsSync(`${taskDir}.complete`)).toBe(true);
5050

@@ -67,9 +67,9 @@ describe("installer tests", () => {
6767
nock.enableNetConnect();
6868
});
6969

70-
it("Gets the latest version of Task 2.5 using 2.5 and no matching version is installed", async () => {
71-
await installer.getTask("2.5", "");
72-
const taskDir = path.join(toolDir, "task", "2.5.2", os.arch());
70+
it("Gets the latest version of Task 3.36 using 3.36 and no matching version is installed", async () => {
71+
await installer.getTask("3.36", "");
72+
const taskDir = path.join(toolDir, "task", "3.36.0", os.arch());
7373

7474
expect(fs.existsSync(`${taskDir}.complete`)).toBe(true);
7575
if (IS_WINDOWS) {
@@ -79,21 +79,9 @@ describe("installer tests", () => {
7979
}
8080
});
8181

82-
it("Gets latest version of Task using 2.x and no matching version is installed", async () => {
83-
await installer.getTask("2.x", "");
84-
const taskdir = path.join(toolDir, "task", "2.6.0", os.arch());
85-
86-
expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
87-
if (IS_WINDOWS) {
88-
expect(fs.existsSync(path.join(taskdir, "bin", "task.exe"))).toBe(true);
89-
} else {
90-
expect(fs.existsSync(path.join(taskdir, "bin", "task"))).toBe(true);
91-
}
92-
});
93-
94-
it("Gets preview version of Task using 3.x and no matching version is installed", async () => {
82+
it("Gets latest version of Task using 3.x and no matching version is installed", async () => {
9583
await installer.getTask("3.x", "");
96-
const taskdir = path.join(toolDir, "task", "3.0.0-preview1", os.arch());
84+
const taskdir = path.join(toolDir, "task", "3.37.2", os.arch());
9785

9886
expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
9987
if (IS_WINDOWS) {
@@ -104,8 +92,8 @@ describe("installer tests", () => {
10492
});
10593

10694
it("Skips version computing when a valid semver is provided", async () => {
107-
await installer.getTask("3.0.0", "");
108-
const taskdir = path.join(toolDir, "task", "3.0.0", os.arch());
95+
await installer.getTask("3.37.0", "");
96+
const taskdir = path.join(toolDir, "task", "3.37.0", os.arch());
10997

11098
expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
11199
if (IS_WINDOWS) {

__tests__/testdata/tags.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,35 @@
248248
"type": "tag",
249249
"url": "https://api.github.com/repos/go-task/task/git/tags/b637b3f832f28ce254377e507170c62cce3c20da"
250250
}
251+
},
252+
{
253+
"ref": "refs/tags/v3.36.0",
254+
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM2LjA=",
255+
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.36.0",
256+
"object": {
257+
"sha": "cc6d0979c6584edc68623aa67ffe29742baeaefe",
258+
"type": "tag",
259+
"url": "https://api.github.com/repos/go-task/task/git/tags/cc6d0979c6584edc68623aa67ffe29742baeaefe"
260+
}
261+
},
262+
{
263+
"ref": "refs/tags/v3.37.1",
264+
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM3LjE=",
265+
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.37.1",
266+
"object": {
267+
"sha": "e48824e99dbccf39dc7d376c2684560945123b30",
268+
"type": "tag",
269+
"url": "https://api.github.com/repos/go-task/task/git/tags/e48824e99dbccf39dc7d376c2684560945123b30"
270+
}
271+
},
272+
{
273+
"ref": "refs/tags/v3.37.2",
274+
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM3LjI=",
275+
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.37.2",
276+
"object": {
277+
"sha": "7aa90b1511c05da43f415d3e6b27aa9866cb40cb",
278+
"type": "tag",
279+
"url": "https://api.github.com/repos/go-task/task/git/tags/7aa90b1511c05da43f415d3e6b27aa9866cb40cb"
280+
}
251281
}
252282
]

0 commit comments

Comments
 (0)