Skip to content
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

perf: better handling of new version releases #279

Merged
merged 1 commit into from
Feb 4, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ coverage
lib
node_modules
*.tgz
*.tsbuildinfo
48 changes: 29 additions & 19 deletions package-lock.json

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

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
"description": "A GitHub Action to set up TeX Live",
"scripts": {
"build": "node scripts/build.mjs",
"clean": "npm run -ws --if-present clean",
"check": "tsc -b packages/tsconfig.project.json",
"check": "tsc -p packages/tsconfig.json --noEmit",
"dprint": "dprint -c packages/config/dprint/config.jsonc",
"pree2e": "rimraf node_modules/.act",
"e2e": "act -W .github/workflows/test.yml",
"e2e:proxy": "act -W .github/workflows/proxy.yml",
"e2e": "npm -w packages/e2e test",
"fmt": "npm run dprint fmt",
"fmt-check": "run-p --aggregate-output -c 'dprint check' fmt-check:ec",
"fmt-check:ec": "git ls-files -z | xargs -0 ec",
Expand Down Expand Up @@ -49,7 +46,6 @@
"markdown-link-check": "^3.11.2",
"npm-run-all2": "^6.1.2",
"patch-package": "^8.0.0",
"rimraf": "^5.0.5",
"taze": "^0.13.2",
"typescript": "^5.3.3",
"vitest": "^1.2.2",
Expand Down
1 change: 0 additions & 1 deletion packages/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
"verbatimModuleSyntax": true,
"lib": ["es2023"],
"target": "esnext",
"composite": true,
},
}
47 changes: 47 additions & 0 deletions packages/e2e/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3'
tasks:
act:
internal: true
dir: '{{ .npm_config_local_prefix }}'
cmd: >-
act
--container-architecture linux/{{ ARCH }}
--workflows {{ .workflows }}
{{ .CLI_ARGS }}
requires:
vars: [workflows]
clear-cache:
cmd: rm -rf "${npm_config_local_prefix}/node_modules/.act"
default:
- task: act
vars:
workflows: .github/workflows/test.yml
CLI_ARGS: >-
--job save-cache
--no-cache-server
historic:
- task: act
vars:
workflows: .github/workflows/{{ .TASK }}.yml
proxy:
- task: act
vars:
workflows: .github/workflows/{{ .TASK }}.yml
test:
deps: [clear-cache]
cmd:
task: act
vars:
workflows: .github/workflows/{{ .TASK }}.yml
fallback-to-historic-master:
deps: [clear-cache]
cmd:
task: act
vars:
workflows: packages/e2e/workflows/{{ .TASK }}.yml
move-to-historic:
deps: [clear-cache]
cmd:
task: act
vars:
workflows: packages/e2e/workflows/{{ .TASK }}.yml
10 changes: 10 additions & 0 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@setup-texlive-action/e2e",
"private": true,
"scripts": {
"test": "task"
},
"devDependencies": {
"@go-task/cli": "^3.34.1"
}
}
32 changes: 32 additions & 0 deletions packages/e2e/workflows/fallback-to-historic-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on: workflow_dispatch
jobs:
save-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup TeX Live
id: setup
uses: ./
with:
version: 2022
- if: fromJSON(steps.setup.outputs.cache-restored)
run: exit 1
- run: >-
tlmgr option repository ctan
restore-cache:
needs: save-cache
runs-on: ubuntu-latest
container:
image: node:20.0
options: --add-host=ftp.math.utah.edu:127.0.0.1
steps:
- uses: actions/checkout@v4
- name: Setup TeX Live
id: setup
uses: ./
with:
version: 2022
- if: ${{ !fromJSON(steps.setup.outputs.cache-hit) }}
run: exit 1
- run: >-
tlmgr option repository | grep -F tug.org
28 changes: 28 additions & 0 deletions packages/e2e/workflows/move-to-historic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: workflow_dispatch
jobs:
save-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup TeX Live
id: setup
uses: ./
with:
version: 2022
- if: fromJSON(steps.setup.outputs.cache-restored)
run: exit 1
- run: |
tlmgr option repository ctan
tlmgr repository add https://mirrors.ctan.org/systems/texlive/tlcontrib/ tlcontrib
restore-cache:
needs: save-cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup TeX Live
id: setup
uses: ./
with:
version: 2022
- if: ${{ !fromJSON(steps.setup.outputs.cache-hit) }}
run: exit 1
4 changes: 2 additions & 2 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"type": "module",
"main": "lib/index.js",
"scripts": {
"clean": "rimraf lib",
"lint": "eslint src tests"
"lint": "eslint src tests",
"test": "vitest"
},
"dependencies": {
"@actions/cache": "^3.2.4",
Expand Down
12 changes: 9 additions & 3 deletions packages/main/src/action/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export namespace Config {
export async function load(): Promise<Config> {
env.init();

const { isLatest } = await ReleaseData.setup();
const releases = await ReleaseData.setup();
const { packageFile, packages, version, ...inputs } = Inputs.load();

const config = {
Expand All @@ -29,16 +29,22 @@ export namespace Config {
packages: await collectPackages({ packageFile, packages }),
};

if (!isLatest(config.version)) {
if (!releases.isLatest(config.version)) {
if (config.tlcontrib) {
log.warn(`TLContrib cannot be used with an older version of TeX Live`);
config.tlcontrib = false;
}
if (config.updateAllPackages) {
if (
!(
releases.isOnePrevious(config.version)
&& releases.newVersionReleased()
) && config.updateAllPackages
) {
log.info('`update-all-packages` is ignored for older versions');
config.updateAllPackages = false;
}
}

return config;
}
}
Expand Down
Loading
Loading