Skip to content

Use versions of Task with Apple Silicon builds in tests #1030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ jobs:
version:
- input: 2.x
expected: "Task version: 2.8.1"
- input: 2.8.x
expected: "Task version: 2.8.1"
- input: 3.4.1
expected: "Task version: 3.4.1"
- input: 3.36.x
expected: "Task version: v3.36.0 (h1:XVJ5hQ5hdzTAulHpAGzbUMUuYr9MUOEQFOFazI3hUsY=)"
- input: 3.37.2
expected: "Task version: v3.37.2 (h1:Jwgvo+2vX79Fu+44xPxVKC5DIkUE89QeDjN2tmYaQzA=)"

exclude:
# The macos-latest runner is an Apple Silicon machine, but Task 2.x is only available for x86 on macOS, which
# would cause a spurious test failure: "Unexpected HTTP response: 404"
- runs-on: macos-latest
version:
input: 2.x
expected: "Task version: 2.8.1"

steps:
- name: Checkout repository
Expand Down
30 changes: 9 additions & 21 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe("installer tests", () => {
});

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

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

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

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

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

it("Gets latest version of Task using 2.x and no matching version is installed", async () => {
await installer.getTask("2.x", "");
const taskdir = path.join(toolDir, "task", "2.6.0", os.arch());

expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(taskdir, "bin", "task.exe"))).toBe(true);
} else {
expect(fs.existsSync(path.join(taskdir, "bin", "task"))).toBe(true);
}
});

it("Gets preview version of Task using 3.x and no matching version is installed", async () => {
it("Gets latest version of Task using 3.x and no matching version is installed", async () => {
await installer.getTask("3.x", "");
const taskdir = path.join(toolDir, "task", "3.0.0-preview1", os.arch());
const taskdir = path.join(toolDir, "task", "3.37.2", os.arch());

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

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

expect(fs.existsSync(`${taskdir}.complete`)).toBe(true);
if (IS_WINDOWS) {
Expand Down
30 changes: 30 additions & 0 deletions __tests__/testdata/tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,35 @@
"type": "tag",
"url": "https://api.github.com/repos/go-task/task/git/tags/b637b3f832f28ce254377e507170c62cce3c20da"
}
},
{
"ref": "refs/tags/v3.36.0",
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM2LjA=",
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.36.0",
"object": {
"sha": "cc6d0979c6584edc68623aa67ffe29742baeaefe",
"type": "tag",
"url": "https://api.github.com/repos/go-task/task/git/tags/cc6d0979c6584edc68623aa67ffe29742baeaefe"
}
},
{
"ref": "refs/tags/v3.37.1",
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM3LjE=",
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.37.1",
"object": {
"sha": "e48824e99dbccf39dc7d376c2684560945123b30",
"type": "tag",
"url": "https://api.github.com/repos/go-task/task/git/tags/e48824e99dbccf39dc7d376c2684560945123b30"
}
},
{
"ref": "refs/tags/v3.37.2",
"node_id": "MDM6UmVmODMyNTI5ODM6cmVmcy90YWdzL3YzLjM3LjI=",
"url": "https://api.github.com/repos/go-task/task/git/refs/tags/v3.37.2",
"object": {
"sha": "7aa90b1511c05da43f415d3e6b27aa9866cb40cb",
"type": "tag",
"url": "https://api.github.com/repos/go-task/task/git/tags/7aa90b1511c05da43f415d3e6b27aa9866cb40cb"
}
}
]
Loading