From 9f3cb5ae8c6a7409ee9389fd0777618251872548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Mon, 9 May 2022 23:24:37 +0200 Subject: [PATCH] Reverse the order of versions It appears more natural to have the versions in the matrix in ascending order. --- .github/workflows/test.yml | 2 +- __tests__/main.test.ts | 4 ++-- src/go-versions.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8a5830..ca259c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,4 +39,4 @@ jobs: - run: | test '${{ steps.go-version.outputs.latest }}' == '1.18' - run: | - test '${{ steps.go-version.outputs.matrix }}' == '["1.18","1.17","1.16","1.15","1.14","1.13"]' + test '${{ steps.go-version.outputs.matrix }}' == '["1.13","1.14","1.15","1.16","1.17","1.18"]' diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index c8254e6..4f6c355 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -12,7 +12,7 @@ test('test minimal version', () => { }) test('test latest version', () => { - expect(latest(['1.18', '1.17', '1.16', '1.15', '1.14', '1.13'])).toEqual( + expect(latest(['1.13', '1.14', '1.15', '1.16', '1.17', '1.18'])).toEqual( '1.18' ) }) @@ -20,5 +20,5 @@ test('test latest version', () => { test('test version matrix', () => { const t = JSON.parse(fs.readFileSync('__tests__/testdata/dl.json', 'utf8')) const m = matrix('1.13', t) - expect(m).toEqual(['1.18', '1.17', '1.16', '1.15', '1.14', '1.13']) + expect(m).toEqual(['1.13', '1.14', '1.15', '1.16', '1.17', '1.18']) }) diff --git a/src/go-versions.ts b/src/go-versions.ts index 80240cc..5497706 100644 --- a/src/go-versions.ts +++ b/src/go-versions.ts @@ -66,7 +66,7 @@ const matrix = (min: string, tags: Version[]): string[] => { return v2 !== null && semverGte(v2, minClean) }) - return versions + return versions.reverse() } const latest = (versions: string[]): string => {