diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-09-24 01:40:10 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-09-24 05:10:13 +0200 |
commit | cc3ced120cdb83b144f9c19d338cb354d15442e8 (patch) | |
tree | d1e99c1e2ea0765d7c721851b89b8c9ef0c90af8 /.github | |
parent | 0b4c30aa02c3ec1dacfc3ac190af4733531753ea (diff) |
Move actions and scripts to separate reusable repos
Add `extension/deps/SCsub`
Diffstat (limited to '.github')
-rw-r--r-- | .github/actions/mingw-cache/action.yml | 18 | ||||
-rw-r--r-- | .github/actions/openvic-build/action.yml | 32 | ||||
-rw-r--r-- | .github/actions/openvic-cache/action.yml | 22 | ||||
-rw-r--r-- | .github/actions/openvic-env/action.yml | 13 | ||||
-rw-r--r-- | .github/actions/openvic-env/commit-environment.js | 30 | ||||
-rwxr-xr-x | .github/actions/openvic-env/url-environment.sh | 57 | ||||
-rw-r--r-- | .github/workflows/builds.yml | 14 |
7 files changed, 8 insertions, 178 deletions
diff --git a/.github/actions/mingw-cache/action.yml b/.github/actions/mingw-cache/action.yml deleted file mode 100644 index e92962d..0000000 --- a/.github/actions/mingw-cache/action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Setup MinGW Cache -description: Setup MinGW Cache -inputs: - cache-key: - description: Name for MinGW cache key. - default: "mingw-cache" -runs: - using: "composite" - steps: - # Upload cache on completion and check it out now - - name: Load MinGW Cache - id: cache-mingw - uses: actions/cache@v3 - with: - path: C:\ProgramData\chocolatey\lib\mingw - key: ${{inputs.cache-key}} - - name: Setup MinGW for build - uses: egor-tensin/setup-mingw@v2
\ No newline at end of file diff --git a/.github/actions/openvic-build/action.yml b/.github/actions/openvic-build/action.yml deleted file mode 100644 index a4b3507..0000000 --- a/.github/actions/openvic-build/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build OpenVic Extension -description: Build OpenVic Extension with provided options. -inputs: - target: - description: Build target (editor, template_release, template_debug). - default: "template_release" - platform: - description: Target platform. - required: false - sconsflags: - default: "" - scons-cache: - description: The scons cache path. - default: "${{ github.workspace }}/.scons-cache/" - scons-cache-limit: - description: The scons cache size limit. - # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. - # Limit to 7 GiB to avoid having the extracted cache fill the disk. - default: 7168 -runs: - using: "composite" - steps: - - name: Scons Build - shell: sh - env: - SCONSFLAGS: ${{ inputs.sconsflags }} - SCONS_CACHE: ${{ inputs.scons-cache }} - SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} - run: | - echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }} - scons platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }} - ls -l game/bin/openvic/
\ No newline at end of file diff --git a/.github/actions/openvic-cache/action.yml b/.github/actions/openvic-cache/action.yml deleted file mode 100644 index b4164eb..0000000 --- a/.github/actions/openvic-cache/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Setup OpenVic Build Cache -description: Setup OpenVic Build Cache -inputs: - cache-name: - description: The cache base name (job name by default). - default: "${{github.job}}" - scons-cache: - description: The scons cache path. - default: "${{github.workspace}}/.scons-cache/" -runs: - using: "composite" - steps: - # Upload cache on completion and check it out now - - name: Load .scons_cache directory - uses: actions/cache@v3 - with: - path: ${{inputs.scons-cache}} - key: ${{inputs.cache-name}}-${{env.OPENVIC_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - restore-keys: | - ${{inputs.cache-name}}-${{env.OPENVIC_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{inputs.cache-name}}-${{env.OPENVIC_BASE_BRANCH}}-${{github.ref}} - ${{inputs.cache-name}}-${{env.OPENVIC_BASE_BRANCH}}
\ No newline at end of file diff --git a/.github/actions/openvic-env/action.yml b/.github/actions/openvic-env/action.yml deleted file mode 100644 index 7c8c4e3..0000000 --- a/.github/actions/openvic-env/action.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Setup OpenVic Environment -description: Setup OpenVic Environment -runs: - using: "composite" - steps: - - name: Setup URL Environment - shell: bash - run: ${GITHUB_ACTION_PATH}/url-environment.sh - - - name: Setup Commit Environment - uses: actions/github-script@v6 - with: - script: require(`${process.env.GITHUB_ACTION_PATH}/commit-environment.js`)({github, context, core}) diff --git a/.github/actions/openvic-env/commit-environment.js b/.github/actions/openvic-env/commit-environment.js deleted file mode 100644 index f6213c2..0000000 --- a/.github/actions/openvic-env/commit-environment.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = async ({github, context, core}) => { - const commit_name = 'OPENVIC_COMMIT'; - const tag_name = 'OPENVIC_TAG'; - const release_name = 'OPENVIC_RELEASE'; - var commit_sha = process.env["GITHUB_SHA"]; - - if(context.eventName === 'pull_request') { - commit_sha = context.payload.pull_request.head.sha; - } - - core.exportVariable(commit_name, commit_sha); - - try { - const release = await github.rest.repos.getLatestRelease({owner: context.repo.owner, repo: context.repo.repo}); - core.exportVariable(tag_name, release.data["tag_name"]); - core.exportVariable(release_name, release.data["name"]); - } catch(error) { - if (error.response.status != 404) throw error; - - const tagList = await github.rest.repos.listTags({owner: context.repo.owner, repo: context.repo.repo}); - if (tagList.data.length == 0) { - core.warning("Could not list tags, this repo has no tags on it, setting tag_name and release_name environment variables to '<UserRepo-NoTag>' and '<UserRepo-NoRelease>', you can fetch tags with 'git fetch --tags' <remote-name>' and push tags with 'git push --tags"); - core.exportVariable(tag_name, `<${context.repo.owner}/${context.repo.repo}-NoTag>`); - core.exportVariable(release_name, `<${context.repo.owner}/${context.repo.repo}-NoRelease>`); - } else { - core.exportVariable(tag_name, tagList.data[0].name); - core.exportVariable(release_name, tagList.data[0].name); - } - } -}
\ No newline at end of file diff --git a/.github/actions/openvic-env/url-environment.sh b/.github/actions/openvic-env/url-environment.sh deleted file mode 100755 index 352218b..0000000 --- a/.github/actions/openvic-env/url-environment.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# $1 = environment name -# $2 = value to set environment -set_var() { - if [[ -z ${!1+set} ]]; then - export $1=$2 - fi -} - -# $1 = left side -# $2 = right side -# returns $1 and $2 joined together with a single '/'' -join_path() { - result=$1 - if [[ $result == *"/" && $2 == "/"* ]]; then - result=${result%/} - fi - if [[ $result != *"/" && $2 != "/"* ]]; then - result="$result/" - fi - echo "$result$2" -} - -# $1 = environment name -set_github_var() { - if [ "${!1}" == "" ]; then - echo "::error::$1 environment variable has not been set." - elif ! curl -o /dev/null --head --silent --fail "${!1}"; then - echo "::error::${!1} does not exist." - else - echo "$1=${!1}" >> $GITHUB_ENV - fi -} - -if [[ $GODOT_BASE_DOWNLOAD_URL == *"downloads.tuxfamily.org/godotengine"* ]]; then - if [[ $GODOT_BASE_DOWNLOAD_URL != *"${GODOT_VERSION}"* ]]; then - GODOT_BASE_DOWNLOAD_URL="$(join_path ${GODOT_BASE_DOWNLOAD_URL} ${GODOT_VERSION})" - fi - if [[ $GODOT_VERSION_TYPE != "stable" ]]; then - GODOT_BASE_DOWNLOAD_URL="$(join_path ${GODOT_BASE_DOWNLOAD_URL} ${GODOT_VERSION_TYPE})" - fi - set_var GODOT_LINUX_URL "$(join_path ${GODOT_BASE_DOWNLOAD_URL} "Godot_v${GODOT_VERSION}-${GODOT_VERSION_TYPE}_linux.x86_64.zip")" - set_var GODOT_TEMPLATE_URL "$(join_path ${GODOT_BASE_DOWNLOAD_URL} "Godot_v${GODOT_VERSION}-${GODOT_VERSION_TYPE}_export_templates.tpz")" -elif [[ $GODOT_BASE_DOWNLOAD_URL == *"github.com/godotengine"* ]]; then - if [[ $GODOT_BASE_DOWNLOAD_URL != *"/releases"* ]]; then - GODOT_BASE_DOWNLOAD_URL=$(join_path $GODOT_BASE_DOWNLOAD_URL "releases") - fi - if [[ $GODOT_BASE_DOWNLOAD_URL != *"/download"* ]]; then - GODOT_BASE_DOWNLOAD_URL=$(join_path $GODOT_BASE_DOWNLOAD_URL "download") - fi - set_var GODOT_LINUX_URL "$(join_path ${GODOT_BASE_DOWNLOAD_URL} "${GODOT_VERSION}-${GODOT_VERSION_TYPE}/Godot_v${GODOT_VERSION}-${GODOT_VERSION_TYPE}_linux.x86_64.zip")" - set_var GODOT_TEMPLATE_URL "$(join_path ${GODOT_BASE_DOWNLOAD_URL} "${GODOT_VERSION}-${GODOT_VERSION_TYPE}/Godot_v${GODOT_VERSION}-${GODOT_VERSION_TYPE}_export_templates.tpz")" -fi - -set_github_var GODOT_LINUX_URL -set_github_var GODOT_TEMPLATE_URL
\ No newline at end of file diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 68da880..ce7265f 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -67,13 +67,14 @@ jobs: submodules: recursive - name: Setup OpenVic build cache - uses: ./.github/actions/openvic-cache + uses: OpenVicProject/openvic-cache@master with: cache-name: ${{ matrix.identifier }} + base-branch: ${{ env.OPENVIC_BASE_BRANCH }} continue-on-error: true - name: Setup Environment - uses: ./.github/actions/openvic-env + uses: OpenVicProject/openvic-env@master - name: Set up Python uses: actions/setup-python@v4 @@ -99,13 +100,14 @@ jobs: - name: Setup MinGW for Windows/MinGW build if: ${{ matrix.platform == 'windows' }} - uses: ./.github/actions/mingw-cache + uses: OpenVicProject/mingw-cache@master - name: Compile Extension - uses: ./.github/actions/openvic-build + uses: OpenVicProject/openvic-build@master with: platform: ${{ matrix.platform }} target: ${{ matrix.target }} + bin-dir: "game/bin/" sconsflags: arch=${{ matrix.arch }} - name: Delete compilation files @@ -148,7 +150,7 @@ jobs: uses: actions/checkout@v3.3.0 - name: Setup Environment - uses: ./.github/actions/openvic-env + uses: OpenVicProject/openvic-env@master - name: Download artifact uses: actions/download-artifact@v3 @@ -188,7 +190,7 @@ jobs: uses: actions/checkout@v3.3.0 - name: Setup Environment - uses: ./.github/actions/openvic-env + uses: OpenVicProject/openvic-env@master - name: Download artifact uses: actions/download-artifact@v3 |