Skip to content

Commit

Permalink
feat: add support for TeX Live 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
teatimeguest committed Mar 11, 2024
1 parent c8ff6a5 commit d62d53c
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-historic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
[
2008, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022
2020, 2021, 2022, 2023,
]
exclude:
- { os: macos, version: 2008 }
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> TeX Live 2024 is scheduled for release on March 13.
> TeX Live 2024 was released on March 13.
> The action may not work properly for a few days after the release.
> If you have any problems, please feel free to open an issue.
Expand Down Expand Up @@ -251,7 +251,11 @@ Supported TeX Live versions are as follows:
<tr>
<th rowspan="2">Linux</th>
<td><code>ubuntu-22.04</code> (<code>ubuntu-latest</code>)</td>
<td rowspan="4"><code>2008</code>&ndash;<code>2023</code></td>
<td rowspan="4">

`2008`&ndash;`2024`

</td>
</tr>
<tr><td><code>ubuntu-20.04</code></td></tr>
<tr>
Expand All @@ -264,7 +268,7 @@ Supported TeX Live versions are as follows:
<td><code>macos-14</code></td>
<td rowspan="4">

`2013`&ndash;`2023`
`2013`&ndash;`2024`

> Versions `2008`–`2012` do not work
> because the `kpsewhich` for those versions is a 32-bit executable
Expand Down Expand Up @@ -292,7 +296,7 @@ All inputs are optional.
| `texdir` | String | TeX Live system installation directory. This has the same effect as the installer's [`-texdir`] option and takes precedence over the `prefix` input and related environment variables. |
| `tlcontrib` | Bool | <p>Set up [TLContrib] as an additional TeX package repository. This input will be ignored for older versions.</p> **Default:**&ensp;`false` |
| `update-all-packages` | Bool | <p>Update all TeX packages when cache restored. Defaults to `false`, and the action will update only `tlmgr`.</p> **Default:**&ensp;`false` |
| `version` | String | <p>TeX Live version to install. Supported values are `2008` to `2023`, and `latest`.</p> **Default:**&ensp;`latest` |
| `version` | String | <p>TeX Live version to install. Supported values are `2008` to `2024`, and `latest`.</p> **Default:**&ensp;`latest` |

[Glob patterns]: https://github.com/actions/toolkit/tree/main/packages/glob#patterns
[TLContrib]: https://contrib.texlive.info
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inputs:
version:
description: >-
TeX Live version to install.
Supported values are `2008` to `2023`, and `latest`.
Supported values are `2008` to `2024`, and `latest`.
default: latest
required: false
outputs:
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e/workflows/fallback-to-historic-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
id: setup
uses: ./
with:
version: 2022
version: 2023
- if: fromJSON(steps.setup.outputs.cache-restored)
run: exit 1
- run: >-
Expand All @@ -25,7 +25,7 @@ jobs:
id: setup
uses: ./
with:
version: 2022
version: 2023
- if: ${{ !fromJSON(steps.setup.outputs.cache-hit) }}
run: exit 1
- run: >-
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e/workflows/move-to-historic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
id: setup
uses: ./
with:
version: 2022
version: 2023
- if: fromJSON(steps.setup.outputs.cache-restored)
run: exit 1
- run: |
Expand All @@ -23,6 +23,6 @@ jobs:
id: setup
uses: ./
with:
version: 2022
version: 2023
- if: ${{ !fromJSON(steps.setup.outputs.cache-hit) }}
run: exit 1
2 changes: 1 addition & 1 deletion packages/e2e/workflows/tlpretest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ jobs:
uses: ./
with:
repository: https://ftp.math.utah.edu/pub/tlpretest/
version: 2024
version: 2025
- run: tlmgr version
8 changes: 6 additions & 2 deletions packages/main/src/texlive/release-data.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"latest": {
"previous": {
"version": "2023",
"releaseDate": "2023-03-19T21:25:25.000Z"
},
"next": {
"current": {
"version": "2024",
"releaseDate": "2024-03-13"
},
"next": {
"version": "2025",
"releaseDate": "2025-03-01"
}
}
8 changes: 4 additions & 4 deletions packages/main/src/texlive/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export namespace ReleaseData {
await latest.checkVersion();
}
function newVersionReleased(): boolean {
return data.latest.version === latest.version;
return data.current.version === latest.version;
}
const latestVersionNumber = Number.parseInt(latest.version, 10);
const releases = {
Expand All @@ -51,7 +51,7 @@ export namespace ReleaseData {
/** @internal */
export class Latest implements Release {
releaseDate: ZonedDateTime | undefined;
#version: Version = data.latest.version as Version;
#version: Version = data.current.version as Version;

get version(): Version {
return this.#version;
Expand Down Expand Up @@ -96,8 +96,8 @@ export class Latest implements Release {
if (this.releaseDate !== undefined) {
return this.releaseDate;
}
if (this.version === data.latest.version) {
return this.releaseDate = ZonedDateTime.from(data.latest.releaseDate);
if (this.version === data.current.version) {
return this.releaseDate = ZonedDateTime.from(data.current.releaseDate);
}
const ctanMaster = await tlnet.ctan({ master: true });
const url = new URL(`TEXLIVE_${this.version}`, ctanMaster);
Expand Down
36 changes: 18 additions & 18 deletions packages/main/tests/__snapshots__/action/cache.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ it('removes tlcontrib', async () => {
yield { tag: 'main', path: MOCK_URL };
yield { tag: 'tlcontrib', path: MOCK_URL };
});
const opts = { version: '2022' } as const;
const opts = { version: '2023' } as const;
await expect(updateTlmgr(opts)).resolves.not.toThrow();
expect(remove).toHaveBeenCalledWith('tlcontrib');
});
Expand Down
7 changes: 3 additions & 4 deletions packages/main/tests/__tests__/texlive/releases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ vi.unmock('#/texlive/releases');
let doMock: () => nock.Scope;

beforeAll(async () => {
json.version.number = LATEST_VERSION;
doMock = () => {
return nock('https://ctan.org')
.get('/json/2.0/pkg/texlive')
Expand All @@ -25,9 +26,7 @@ describe('LatestRelease', () => {
describe('checkVersion', () => {
it('checks for latest version using the CTAN API', async () => {
const mock = doMock();
await expect(new Latest().checkVersion()).resolves.toBe(
LATEST_VERSION,
);
await expect(new Latest().checkVersion()).resolves.toBe(LATEST_VERSION);
expect(mock.isDone()).toBeTrue();
});

Expand Down Expand Up @@ -55,7 +54,7 @@ describe('ReleaseData.setup', () => {
vi.spyOn(Temporal.Now, 'instant').mockReturnValueOnce(
Temporal
.PlainDateTime
.from('2024-04-01')
.from('2025-03-01')
.toZonedDateTime('UTC')
.toInstant(),
);
Expand Down
4 changes: 2 additions & 2 deletions packages/main/tests/setup-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import '@setup-texlive-action/config/vitest/setup-jest-extended.js';
import '#/globals';
import type { Version } from '#/texlive/version';

import { latest } from '#/texlive/release-data.json';
import { current } from '#/texlive/release-data.json';

vi.stubGlobal('LATEST_VERSION', latest.version as Version);
vi.stubGlobal('LATEST_VERSION', current.version as Version);
// https://www.rfc-editor.org/rfc/rfc2606.html
vi.stubGlobal('MOCK_URL', 'https://example.com/');

Expand Down

0 comments on commit d62d53c

Please sign in to comment.