From 7c95d416349d538532d09eabe1c025fd9c2fa363 Mon Sep 17 00:00:00 2001 From: otavepto Date: Sat, 20 Apr 2024 05:15:11 +0200 Subject: [PATCH] workflows for the migration script --- .github/workflows/build-migrate_gse-linux.yml | 73 ++++++++++++++++ .github/workflows/build-migrate_gse-win.yml | 87 +++++++++++++++++++ README.md | 13 +++ 3 files changed, 173 insertions(+) create mode 100644 .github/workflows/build-migrate_gse-linux.yml create mode 100644 .github/workflows/build-migrate_gse-win.yml diff --git a/.github/workflows/build-migrate_gse-linux.yml b/.github/workflows/build-migrate_gse-linux.yml new file mode 100644 index 00000000..65fee7a5 --- /dev/null +++ b/.github/workflows/build-migrate_gse-linux.yml @@ -0,0 +1,73 @@ +name: Migrate GSE script (Linux) + +on: + push: + branches: [ + "ci-build-migrate-linux*", + "ci-build-all" + ] + tags: + - release* + pull_request: + branches: [ "dev" ] + workflow_dispatch: + # allows manual trigger + +permissions: + contents: write + +env: + ARTIFACT_NAME: "migrate_gse-linux-${{ github.sha }}" + SCRIPT_BASE_DIR: "tools/migrate_gse" + PACKAGE_BASE_DIR: "tools/migrate_gse/bin/package/linux" + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout branch + uses: actions/checkout@v4 + +### fix folder permissions! not sure why this fails + # nested subdirs "build/linux/release" cause permission problems + - name: Give all permissions for repo folder + shell: bash + working-directory: ${{ github.workspace }} + run: sudo chmod -R 777 "${{ github.workspace }}" + +# deps + - name: Install dependencies + shell: bash + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: sudo chmod 77 recreate_venv_linux.sh && sudo ./recreate_venv_linux.sh + +# build + - name: Rebuild + shell: bash + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: sudo chmod 77 rebuild_linux.sh && sudo ./rebuild_linux.sh + +# package + - name: Package build + shell: bash + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: sudo chmod 77 package_linux.sh && sudo ./package_linux.sh + +# upload artifact + - name: Upload build package + uses: actions/upload-artifact@v4 + with: + name: "${{ env.ARTIFACT_NAME }}" + path: "${{ env.PACKAGE_BASE_DIR }}/" + if-no-files-found: 'error' + compression-level: 9 + retention-days: 1 + +# release tag + - name: Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: "${{ env.PACKAGE_BASE_DIR }}/**/*" + \ No newline at end of file diff --git a/.github/workflows/build-migrate_gse-win.yml b/.github/workflows/build-migrate_gse-win.yml new file mode 100644 index 00000000..4462b86c --- /dev/null +++ b/.github/workflows/build-migrate_gse-win.yml @@ -0,0 +1,87 @@ +name: Migrate GSE script (Windows) + +on: + push: + branches: [ + "ci-build-migrate-win*", + "ci-build-all" + ] + tags: + - release* + pull_request: + branches: [ "dev" ] + workflow_dispatch: + # allows manual trigger + +permissions: + contents: write + +env: + ARTIFACT_NAME: "migrate_gse-win-${{ github.sha }}" + SCRIPT_BASE_DIR: "tools/migrate_gse" + PACKAGE_BASE_DIR: "tools/migrate_gse/bin/package/win" + + THIRD_PARTY_BASE_DIR: 'third-party' + + +jobs: + build: + runs-on: windows-2022 + + steps: + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Checkout branch + uses: actions/checkout@v4 + +## extra helpers/tools, these are not built inside the deps build dir + - name: Clone third-party deps (deps/win) + uses: actions/checkout@v4 + with: + ref: 'third-party/deps/win' + path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win" + + - name: Clone third-party deps (build/win) + uses: actions/checkout@v4 + with: + ref: 'third-party/build/win' + path: "${{env.THIRD_PARTY_BASE_DIR}}/build/win" + +# deps + - name: Install dependencies + shell: cmd + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: recreate_venv_win.bat + +# build + - name: Rebuild + shell: cmd + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: rebuild_win.bat + +# package + - name: Package build + shell: cmd + working-directory: "${{ env.SCRIPT_BASE_DIR }}" + run: package_win.bat + +# upload artifact + - name: Upload build package + uses: actions/upload-artifact@v4 + with: + name: "${{ env.ARTIFACT_NAME }}" + path: "${{ env.PACKAGE_BASE_DIR }}/" + if-no-files-found: 'error' + compression-level: 9 + retention-days: 1 + +# release tag + - name: Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: "${{ env.PACKAGE_BASE_DIR }}/**/*" + \ No newline at end of file diff --git a/README.md b/README.md index e91d1840..49f8adf2 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,19 @@ The following are special branches, pushing any code to them will trigger the bu >>>>>>>>> ___ +* `ci-build-migrate-linux*`: any branch matching this pattern will trigger the **Linux** build of the script `migrate_gse` + Example of a valid branch name: + - `ci-build-migrate-linux` + - `ci-build-migrate-linux-test1` + - `ci-build-migrate-linux_trial` +* `ci-build-migrate-win*`: any branch matching this pattern will trigger the **Windows** build of the script `migrate_gse` + Example of a valid branch name: + - `ci-build-migrate-win` + - `ci-build-migrate-win-test1` + - `ci-build-migrate-win_trial` + +>>>>>>>>> ___ + * `ci-build-all`: pushing code to this exact branch will trigger all builds ---