Skip to content

Commit

Permalink
updating CI
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Dec 6, 2024
1 parent 9e7c313 commit 303489b
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 22 deletions.
37 changes: 36 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,30 @@ env:
DOTNET_NOLOGO: 1

jobs:
electron-versions:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.electron-versions.outputs.matrix }}

name: Resolve latest electron versions
steps:
- name: Get latest Electron versions for 29, 30, 31, 32, 33
id: electron-versions
shell: bash
run: |
node tools/getVersions.js
echo "matrix=$(cat electron.txt)" >> $GITHUB_OUTPUT
test:
runs-on: ${{ matrix.os }}
needs: electron-versions
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, ubuntu-22.04, windows-2022]
# os: [ macos-14, ubuntu-22.04]
# electron: [32.1.2]
electron: [29.4.6, 30.5.1, 31.7.6, 32.2.7, 33.3.0]
electron: ${{ fromJSON(needs.electron-versions.outputs.matrix) }}
# electron: [31.6.0, 32.1.0]

name: test-${{ matrix.os }}-v${{ matrix.electron }}
Expand Down Expand Up @@ -136,3 +151,23 @@ jobs:
os: ${{ matrix.os }}


# electron-versions:
# runs-on: ubuntu-22.04
# outputs:
# matrix: ${{ steps.electron-test-versions.outputs.matrix }}

# needs: build
# name: electron-versions
# steps:
# - name: Electron versions
# shell: bash
# id: electron-versions
# run: echo "matrix={'include':[{'electron':'29.4.6', 'os':'windows-2022'},{'electron':'30.5.1', 'os':'windows-2022'},{'electron':'31.7.5', 'os':'windows-2022'},{'electron':'32.2.6', 'os':'windows-2022'},{'electron':'33.2.1', 'os':'windows-2022'}]}" >> $GITHUB_OUTPUT

# test1:
# strategy:
# matrix:
# electron: ${{ fromJSON(needs.electron-versions.outputs.matrix) }}
# os: [1]
# runs-on: ${{ matrix.os }}
# needs: electron-versions
42 changes: 21 additions & 21 deletions tools/getVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ const http = require('isomorphic-git/http/web');
const git = require("isomorphic-git");


git.getRemoteInfo({
http,
//corsProxy: "https://cors.isomorphic-git.org",
url: "https://github.com/electron/electron"
}).then(info =>{
let result = Object.keys(info.refs.tags);
result = result
.filter(function (str) { return !str.includes('^'); })
.filter(function (str) { return !str.includes('-'); })
.filter(function (str) { return str.startsWith(`v${process.argv[2]}.`); })
.sort()
.reverse();
git.getRemoteInfo({
http,
//corsProxy: "https://cors.isomorphic-git.org",
url: "https://github.com/electron/electron"
}).then(info =>{
let result = Object.keys(info.refs.tags);
result = result
.filter(function (str) { return !str.includes('^'); })
.filter(function (str) { return !str.includes('-'); })
.filter(function (str) { return str.startsWith(`v${process.argv[2]}.`); })
.sort()
.reverse();

if(result.length !== 0){
let version = result[0].replace('v', '')
fs.writeFileSync('electron.txt', version);
console.log(version);
}
else{
throw `Unable to resolve latest version for Electron ${process.argv[2]}`
}
});
if(result.length !== 0){
let version = result[0].replace('v', '')
fs.writeFileSync('electron.txt', version);
console.log(version);
}
else{
throw `Unable to resolve latest version for Electron ${process.argv[2]}`
}
});


43 changes: 43 additions & 0 deletions tools/getVersions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const fs = require("fs");
const http = require('isomorphic-git/http/web');
const git = require("isomorphic-git");
const { get } = require("https");

const majors = [29, 30, 31, 32, 33];

git.getRemoteInfo({
http,
//corsProxy: "https://cors.isomorphic-git.org",
url: "https://github.com/electron/electron"
}).then(info =>{
let result = Object.keys(info.refs.tags);
let versions = [];
majors.forEach((major) => {
versions.push(getVersion(result, major));
});
let res = `{'include':${JSON.stringify(versions)}}`
fs.writeFileSync('electron.txt', res);
console.log(res);
});

function getVersion(result, major){
result = result
.filter(function (str) { return !str.includes('^'); })
.filter(function (str) { return !str.includes('-'); })
.filter(function (str) { return str.startsWith(`v${major}.`); })
.sort()
.reverse();

if(result.length !== 0){
return {'electron':`${result[0].replace('v', '')}`}
//fs.writeFileSync('electron.txt', version);
//console.log(version);
}
else{
throw `Unable to resolve latest version for Electron ${major}`
}

}



0 comments on commit 303489b

Please sign in to comment.