From 3a89763b86d46799c9b6ae990e708056e6ca8ce5 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 25 Jun 2022 03:26:39 -0400 Subject: [PATCH] Fix the "default arch" code path with Julia nightly (and add a CI job for that code path) (#115) --- .github/workflows/backup.yml | 1 + .github/workflows/checkin.yml | 7 ++++ .github/workflows/codeql-analysis.yml | 7 ++++ .../workflows/example-builds-defaultarch.yml | 7 ++++ .../example-builds-nightly-defaultarch.yml | 38 +++++++++++++++++++ .github/workflows/example-builds-nightly.yml | 11 +++++- .github/workflows/example-builds.yml | 9 ++++- lib/installer.js | 5 +-- lib/setup-julia.js | 13 ++++++- src/installer.ts | 5 +-- src/setup-julia.ts | 15 +++++++- 11 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/example-builds-nightly-defaultarch.yml diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml index 1b08aa5..39747f1 100644 --- a/.github/workflows/backup.yml +++ b/.github/workflows/backup.yml @@ -9,6 +9,7 @@ on: jobs: backup: runs-on: ubuntu-20.04 + timeout-minutes: 60 steps: - name: Configure cache diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index 485ee74..1fab662 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -1,9 +1,16 @@ name: "PR Checks" on: [pull_request, push] +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: check_pr: runs-on: ubuntu-latest + timeout-minutes: 60 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 067ec31..aecf7f9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,6 +11,12 @@ # name: "CodeQL" +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + on: push: branches: [ master, releases/* ] @@ -24,6 +30,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + timeout-minutes: 60 strategy: fail-fast: false diff --git a/.github/workflows/example-builds-defaultarch.yml b/.github/workflows/example-builds-defaultarch.yml index 42c14c2..56fc3a4 100644 --- a/.github/workflows/example-builds-defaultarch.yml +++ b/.github/workflows/example-builds-defaultarch.yml @@ -1,5 +1,11 @@ name: Example builds (default arch) +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + on: push: branches: ['main', 'master', 'releases/*'] @@ -9,6 +15,7 @@ on: jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: fail-fast: false matrix: diff --git a/.github/workflows/example-builds-nightly-defaultarch.yml b/.github/workflows/example-builds-nightly-defaultarch.yml new file mode 100644 index 0000000..1ddf4f4 --- /dev/null +++ b/.github/workflows/example-builds-nightly-defaultarch.yml @@ -0,0 +1,38 @@ +name: Example builds (nightly, default arch) + +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +on: + push: + branches: ['main', 'master', 'releases/*'] + pull_request: + +jobs: + test: + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + julia-version: [nightly, 1.8-nightly] + os: [ubuntu-latest, macOS-latest, windows-latest] + + steps: + - uses: actions/checkout@v1.0.0 + + - name: "Install dependencies" + run: | + npm install --legacy-peer-deps + npm run build + npm run pack + + - name: "Set up Julia (${{ matrix.julia-version }})" + uses: ./ + with: + version: ${{ matrix.julia-version }} + - run: julia --version + - run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()' diff --git a/.github/workflows/example-builds-nightly.yml b/.github/workflows/example-builds-nightly.yml index 73f191b..e57678f 100644 --- a/.github/workflows/example-builds-nightly.yml +++ b/.github/workflows/example-builds-nightly.yml @@ -1,5 +1,11 @@ name: Example builds (nightly) +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + on: push: branches: ['main', 'master', 'releases/*'] @@ -10,6 +16,7 @@ on: jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -20,10 +27,10 @@ jobs: exclude: - os: macOS-latest julia-arch: x86 - + steps: - uses: actions/checkout@v1.0.0 - + - name: "Install dependencies" run: | npm install --legacy-peer-deps diff --git a/.github/workflows/example-builds.yml b/.github/workflows/example-builds.yml index 7111261..f3ebd9d 100644 --- a/.github/workflows/example-builds.yml +++ b/.github/workflows/example-builds.yml @@ -1,5 +1,11 @@ name: Example builds +concurrency: + # Skip intermediate builds: all builds except for builds on the `master`, `main`, or `release-*` branches + # Cancel intermediate builds: only pull request builds + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.ref != 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + on: push: branches: ['main', 'master', 'releases/*'] @@ -9,6 +15,7 @@ on: jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -19,7 +26,7 @@ jobs: exclude: - os: macOS-latest julia-arch: x86 - + steps: - uses: actions/checkout@v1.0.0 diff --git a/lib/installer.js b/lib/installer.js index 95fdc7b..e97e625 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -32,11 +32,8 @@ const osMap = { }; const archMap = { 'x86': 'i686', - 'X86': 'i686', 'x64': 'x86_64', - 'X64': 'x86_64', - 'aarch64': 'aarch64', - 'ARM64': 'aarch64' + 'aarch64': 'aarch64' }; // Store information about the environment const osPlat = os.platform(); // possible values: win32 (Windows), linux (Linux), darwin (macOS) diff --git a/lib/setup-julia.js b/lib/setup-julia.js index 8d17fc1..e83f709 100644 --- a/lib/setup-julia.js +++ b/lib/setup-julia.js @@ -21,6 +21,14 @@ const fs = __importStar(require("fs")); const https = __importStar(require("https")); const path = __importStar(require("path")); const installer = __importStar(require("./installer")); +const archSynonyms = { + 'x86': 'x86', + 'X86': 'x86', + 'x64': 'x64', + 'X64': 'x64', + 'aarch64': 'aarch64', + 'ARM64': 'aarch64' +}; function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -41,7 +49,7 @@ function run() { } // Inputs const versionInput = core.getInput('version'); - const arch = core.getInput('arch'); + const originalArchInput = core.getInput('arch'); // It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}` // while the strategy matrix only contains a key `${{ matrix.version }}`. // In that case, we want the action to fail, rather than trying to download julia from an URL that's missing parts and 404ing. @@ -50,9 +58,10 @@ function run() { if (!versionInput) { throw new Error('Version input must not be null'); } - if (!arch) { + if (!originalArchInput) { throw new Error(`Arch input must not be null`); } + const arch = archSynonyms[originalArchInput]; const versionInfo = yield installer.getJuliaVersionInfo(); const availableReleases = yield installer.getJuliaVersions(versionInfo); const version = installer.getJuliaVersion(availableReleases, versionInput); diff --git a/src/installer.ts b/src/installer.ts index d771959..8a1e94b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -18,11 +18,8 @@ const osMap = { } const archMap = { 'x86': 'i686', - 'X86': 'i686', 'x64': 'x86_64', - 'X64': 'x86_64', - 'aarch64': 'aarch64', - 'ARM64': 'aarch64' + 'aarch64': 'aarch64' } // Store information about the environment diff --git a/src/setup-julia.ts b/src/setup-julia.ts index 6ac61ec..d27d991 100644 --- a/src/setup-julia.ts +++ b/src/setup-julia.ts @@ -8,6 +8,15 @@ import * as path from 'path' import * as installer from './installer' +const archSynonyms = { + 'x86': 'x86', + 'X86': 'x86', + 'x64': 'x64', + 'X64': 'x64', + 'aarch64': 'aarch64', + 'ARM64': 'aarch64' +} + async function run() { try { // Debugging info @@ -30,7 +39,7 @@ async function run() { // Inputs const versionInput = core.getInput('version') - const arch = core.getInput('arch') + const originalArchInput = core.getInput('arch') // It can easily happen that, for example, a workflow file contains an input `version: ${{ matrix.julia-version }}` // while the strategy matrix only contains a key `${{ matrix.version }}`. @@ -40,10 +49,12 @@ async function run() { if (!versionInput) { throw new Error('Version input must not be null') } - if (!arch) { + if (!originalArchInput) { throw new Error(`Arch input must not be null`) } + const arch = archSynonyms[originalArchInput] + const versionInfo = await installer.getJuliaVersionInfo() const availableReleases = await installer.getJuliaVersions(versionInfo) const version = installer.getJuliaVersion(availableReleases, versionInput)