diff --git a/.github/workflows/update-ref.yml b/.github/workflows/update-ref.yml new file mode 100644 index 00000000..5212e2b6 --- /dev/null +++ b/.github/workflows/update-ref.yml @@ -0,0 +1,54 @@ +name: Update references for commits, tags, etc + +on: + workflow_dispatch: + schedule: + - cron: '0 0 1 * *' # Run on the first day of every month + +jobs: + build: + + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + + env: + DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1001/bus + SHELL: /usr/bin/bash + FILE_PATHS: | + integration-tests/src/utils/version.ts + scripts/fetch-docs.sh + scripts/fetch-poky.sh + + strategy: + matrix: + node-version: [20] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Update required extension version + run: bash scripts/update-ref.sh + + - name: Verify file changes + uses: tj-actions/verify-changed-files@v17 + id: verify-changed-files + with: + files: ${{ env.FILE_PATHS }} + + - name: Create pull request + if: steps.verify-changed-files.outputs.files_changed == 'true' + uses: peter-evans/create-pull-request@v5 + with: + add-paths: ${{ env.FILE_PATHS }} + title: Auto update references for commits, tags, etc + commit-message: Auto update references for commits, tags, etc + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/integration-tests/src/runTest.ts b/integration-tests/src/runTest.ts index a2ec5dde..05ac7cd7 100644 --- a/integration-tests/src/runTest.ts +++ b/integration-tests/src/runTest.ts @@ -10,6 +10,7 @@ import { resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron' +import { pythonVersion, bashVersion } from './utils/version' async function main (): Promise { try { @@ -20,8 +21,8 @@ async function main (): Promise { cliPath, [ ...args, - '--install-extension', 'mads-hartmann.bash-ide-vscode@1.39.0', - '--install-extension', 'ms-python.python@2023.20.0' + '--install-extension', `mads-hartmann.bash-ide-vscode@${bashVersion}`, + '--install-extension', `ms-python.python@${pythonVersion}` ], { encoding: 'utf-8', diff --git a/integration-tests/src/utils/version.ts b/integration-tests/src/utils/version.ts new file mode 100644 index 00000000..153ace0b --- /dev/null +++ b/integration-tests/src/utils/version.ts @@ -0,0 +1,8 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) 2023 Savoir-faire Linux. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ + +// Required extension versions +export const bashVersion = '1.39.0' +export const pythonVersion = '2024.2.1' diff --git a/package.json b/package.json index c16e69b9..9a60bad7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "postinstall": "cd server && npm install && cd ../client && npm install", "fetch": "npm run fetch:poky && npm run fetch:docs", "fetch:docs": "sh scripts/fetch-docs.sh", - "fetch:poky": "mkdir -p resources/poky && curl -L -o resources/poky.tar.bz2 https://downloads.yoctoproject.org/releases/yocto/yocto-4.2.3/poky-aa63b25cbe25d89ab07ca11ee72c17cab68df8de.tar.bz2 && tar -xvjf resources/poky.tar.bz2 -C resources", + "fetch:poky": "sh scripts/fetch-poky.sh", "compile": "npm run installServer && tsc -b", "watch": "npm run installServer && tsc -b -w", "installServer": "cd server && npm run installServer", diff --git a/scripts/fetch-docs.sh b/scripts/fetch-docs.sh index aa795c55..c89ccc5f 100644 --- a/scripts/fetch-docs.sh +++ b/scripts/fetch-docs.sh @@ -1,9 +1,11 @@ #!/bin/bash -BITBAKE_DOCS_COMMIT=595176d6be95a9c4718d3a40499d1eb576b535f5 -BITBAKE_DOCS_LIST="bitbake-user-manual-metadata.rst bitbake-user-manual-ref-variables.rst" +# Tag: yocto-4.3.3 +BITBAKE_DOCS_COMMIT=380a9ac97de5774378ded5e37d40b79b96761a0c +# Tag: yocto-4.3.3 +YOCTO_DOCS_COMMIT=dde4b815db82196af086847f68ee27d7902b4ffa -YOCTO_DOCS_COMMIT=897d5017eae6b3af2d5d489fc4e0915d9ce21458 +BITBAKE_DOCS_LIST="bitbake-user-manual-metadata.rst bitbake-user-manual-ref-variables.rst" YOCTO_DOCS_LIST=" tasks.rst variables.rst" set -e diff --git a/scripts/fetch-poky.sh b/scripts/fetch-poky.sh new file mode 100644 index 00000000..a77282d3 --- /dev/null +++ b/scripts/fetch-poky.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Tag: yocto-4.3.3 +COMMIT=d3b27346c3a4a7ef7ec517e9d339d22bda74349d + +set -e + +mkdir -p resources/poky +cd resources/poky +git clone https://github.com/yoctoproject/poky.git . +git fetch origin +git checkout $COMMIT + diff --git a/scripts/update-ref.sh b/scripts/update-ref.sh new file mode 100644 index 00000000..c0bfd165 --- /dev/null +++ b/scripts/update-ref.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# Update the fetch-poky.sh script +FILE="scripts/fetch-poky.sh" +TMP_FILE="tmp.txt" +tail -n +6 $FILE > $TMP_FILE + +echo "#!/bin/bash" > $FILE +echo "" >> $FILE + +git clone --depth 1 --filter=blob:none --sparse https://github.com/yoctoproject/poky.git +cd poky +git fetch --tags +TMP_TAG=$(git tag | grep "yocto-" | tail -n 1) # There is a tag: yocto_1.5_M5.rc8 which will take the tail, thus adding a hyphen +LASTEST_RELEASE=$(git show $TMP_TAG | grep commit | sed "s/^commit //") +echo "# Tag: $TMP_TAG" >> ../$FILE +echo "COMMIT=$LASTEST_RELEASE" >> ../$FILE +echo "" >> ../$FILE +cd .. +rm -rf poky + +cat $TMP_FILE >> $FILE +rm $TMP_FILE + +# Update the version.ts +DEST="integration-tests/src/utils/version.ts" + +# Keep the header +TOTAL_LINES=$(wc -l < $DEST) +LINES_TO_KEEP=$(($TOTAL_LINES - 2)) +TMP="tmp.ts" +head -n $LINES_TO_KEEP $DEST > $TMP + +git clone --depth 1 --filter=blob:none --sparse https://github.com/bash-lsp/bash-language-server +cd bash-language-server +git fetch --tags +echo "export const bashVersion = '$(git tag --sort=-v:refname | head -n 1 | sed "s/^vscode-client-//")'" >> ../$TMP +cd .. +rm -rf bash-language-server + +git clone --depth 1 --filter=blob:none --sparse https://github.com/Microsoft/vscode-python +cd vscode-python +git fetch --tags +echo "export const pythonVersion = '$(git tag --sort=-v:refname | head -n 1 | sed "s/^v//")'" >> ../$TMP +cd .. +rm -rf vscode-python + +cp $TMP $DEST +rm $TMP + +# Update the fetch-docs.sh script +FILE="scripts/fetch-docs.sh" +TMP_FILE="tmp.txt" +tail -n +8 $FILE > $TMP_FILE + +echo "#!/bin/bash" > $FILE +echo "" >> $FILE + +git clone --depth 1 --filter=blob:none --sparse https://github.com/openembedded/bitbake.git +cd bitbake +git fetch --tags +TMP_TAG=$(git tag | tail -n 1) +LASTEST_RELEASE=$(git show $TMP_TAG | grep commit | sed "s/^commit //") +echo "# Tag: $TMP_TAG" >> ../$FILE +echo "BITBAKE_DOCS_COMMIT=$LASTEST_RELEASE" >> ../$FILE +cd .. +rm -rf bitbake + +git clone --depth 1 --filter=blob:none --sparse https://git.yoctoproject.org/yocto-docs +cd yocto-docs +git fetch --tags +TMP_TAG=$(git tag | tail -n 1) +LASTEST_RELEASE=$(git show $TMP_TAG | grep commit | sed "s/^commit //") +echo "# Tag: $TMP_TAG" >> ../$FILE +echo "YOCTO_DOCS_COMMIT=$LASTEST_RELEASE" >> ../$FILE +echo "" >> ../$FILE +cd .. +rm -rf yocto-docs + +cat $TMP_FILE >> $FILE +rm $TMP_FILE \ No newline at end of file