Current project: https://github.com/miyako/4d-a-simple-project
A CI/CD template project.
A 🌀Run Tests workflow is automatically triggered when code is changed in the main
branch.
This workflow does the following:
- Launch 2 GitHub hosted runners:
windows-latest
macos-latest
- Checkout the current repository
- Checkout the latest
compiler
project from releases - Download
tool4d
- Run a specific
--startup-method
withtool4d
andcompiler
project
Sample result: actions/runs/8025901243
Only changes relevant to code execution will trigger the workflow:
on:
push:
branches:
- main
paths:
- '*/Project/Sources/**/*.4dm'
- '*/Project/Sources/*/*.4DForm'
- '*/Project/Sources/*.4DCatalog'
A specific branch, product and build of tool4d
is used:
jobs:
get:
strategy:
fail-fast: false
matrix:
TOOL4D_PLATFORM: ["windows-latest", "macos-latest"]
TOOL4D_BRANCH: [20.x]
TOOL4D_VERSION: [20.2]
TOOL4D_BUILD: [latest]
runs-on: ${{ matrix.TOOL4D_PLATFORM }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: get tool4d
id: get
uses: miyako/4D/.github/actions/tool4d-download@v1
with:
platform: ${{ matrix.TOOL4D_PLATFORM }}
branch: ${{ matrix.TOOL4D_BRANCH }}
version: ${{ matrix.TOOL4D_VERSION }}
build: ${{ matrix.TOOL4D_BUILD }}
Any combination of runners, tool4d
, projects, --startup-method
can be specified in a strategy matrix:
jobs:
get:
strategy:
fail-fast: false
matrix:
TOOL4D_BUILD: [latest]
TOOL4D_STARTUP_METHOD: [test]
TOOL4D_STARTUP_PROJECT_PATH: [./application/Project/application.4DProject]
runs-on: ${{ matrix.TOOL4D_PLATFORM }}
steps:
- name: run tests
uses: ./.github/actions/run-tests
with:
tool4d_download_url: ${{ steps.get.outputs.tool4d_download_url }}
tool4d_executable_path: ${{ steps.get.outputs.tool4d_executable_path }}
startup_method: ${{ matrix.TOOL4D_STARTUP_METHOD }}
project_path: ${{ matrix.TOOL4D_STARTUP_PROJECT_PATH }}
A 🎉Build and Publish workflow can be trigged manually.
This workflow does the following:
- Prompt to choose the kind of version bump:
patch
,minor
,major
- Update
package.json
at the root of the project (the version information in this file is incorporated in the build process) - Create a release that corresponds to the new version
- Connect to a self-hosted runner (build must always take place on a self-hosted runner with licenses installed)
- (Do not run units tests, which would have been done already on GitHub hosted runners, as described above)
- Checkout the current repository
- Checkout the latest
compiler
project from releases - Download
tool4d
- Build, sign, archive, notarise, staple the product
- Uploaded .dmg to the release created earlier
Sample result: actions/runs/8026370678
This workflow is also triggered automatically, according to the same filter as 🌀Run Tests
.
- (Do not prompt for inputs)
- (Do not bump the version)
- (Do not create releases)
- Connect to a self-hosted runner (build must always take place on a self-hosted runner with licenses installed)
- Run unit tests
- Checkout the current repository
- Checkout the latest
compiler
project from releases - Download
tool4d
- Build, sign the product
- (Do not archive or upload the .app)
Sample result: actions/runs/8026309928
Because the deployment
job needs the release
job, it is important to checkout the repository with ref: ${{ github.ref }}
to get the latest commit from the bump
job. Otherwise, the commit that is checked out would be from the moment the workflow was triggered which is a version behind.
Although one can configure the self-hosted runner application as a service, the codesign script seems to fail when executed in a background process (maybe there is a workaround, don't know). For the purpose of building 4D applications, it seems better to ./ron.sh
the runner in a Terminal window, manually, or as a login item.