9be7c2b1ac
This adds the option FULLY_STATIC to create fully-static executables. To create portable, fully-static release executables on Linux, we need to use musl instead of glibc. Static executables from glibc are not portable. The popular musl-gcc wrapper does not support C++, so instead we use a full musl cross-compiler toolchain in the build workflow. To build FULLY_STATIC, the user must point to the appropriate cross-compiler, as we do in the workflow. On systems where musl is the native libc (such as Alpine Linux), this is not necessary. I have also read that musl's allocator is not very fast in multi-threaded applications. So when FULLY_STATIC is enabled, we will also enable mimalloc, a replacement allocator that is very fast. I tested a very basic packaging command to compare speeds of dynamic glibc, static musl, and static musl+mimalloc: dynamic glibc: runs: 2.527, 2.798, 2.703, 2.756, 2.959 avg = 2.749, std dev = 0.156s static musl: runs: 2.813, 2.920, 3.129, 3.003, 2.738 avg = 2.921s, std dev = 0.154s static musl+mimalloc: runs: 2.291, 2.034, 2.415, 2.303, 2.265 avg = 2.262s, std dev = 0.140s The mimalloc build is 82% faster than musl default allocator, 77% faster than glibc, and has more consistent runtime characteristics (lower standard deviation). |
||
---|---|---|
.. | ||
README.md | ||
build-docker.yaml | ||
build-docs.yaml | ||
build-matrix.json | ||
build.yaml | ||
lint.yaml | ||
pr.yaml | ||
publish-docker.yaml | ||
publish-docs.yaml | ||
publish-npm.yaml | ||
release-please.yaml | ||
settings.yaml | ||
sync-labels.yaml | ||
test-linux-distros.yaml | ||
update-issues.yaml | ||
validate-pr-title.yaml |
README.md
GitHub Actions CI
Reusable workflows
-
build.yaml
: Build and test all combinations of OS & build settings. Also builds docs on Linux. -
build-docs.yaml
: Build Packager docs. Runs only on Linux. -
build-docker.yaml
: Build the official Docker image. -
lint.yaml
: Lint Shaka Packager. -
publish-docs.yaml
: Publish Packager docs. Runs on the latest release. -
publish-docker.yaml
: Publish the official docker image. Runs on all releases. -
publish-npm.yaml
: Publish binaries to NPM. Runs on all releases. -
test-linux-distros.yaml
: Test the build on all Linux distros via docker.
Composed workflows
- On PR (
pr.yaml
), invoke:lint.yaml
build.yaml
build-docs.yaml
build-docker.yaml
test-linux-distros.yaml
Release workflow
release-please.yaml
- Updates changelogs, version numbers based on conventional commits syntax and semantic versioning
- Generates/updates a PR on each push
- When the PR is merged, runs additional steps:
- Creates a GitHub release
- Invokes
publish-docs.yaml
to publish the docs - Invokes
publish-docker.yaml
to publish the docker image - Invokes
build.yaml
- Attaches the binaries from
build.yaml
to the GitHub release - Invokes
publish-npm.yaml
to publish the binaries to NPM
Common workflows from shaka-project
sync-labels.yaml
update-issues.yaml
validate-pr-title.yaml
Required Repo Secrets
RELEASE_PLEASE_TOKEN
: A PAT forshaka-bot
to run therelease-please
action. If missing, the release workflow will use the defaultGITHUB_TOKEN
DOCKERHUB_CI_USERNAME
: The username of the Docker Hub CI accountDOCKERHUB_CI_TOKEN
: An access token for Docker Hub- To generate, visit https://hub.docker.com/settings/security
DOCKERHUB_PACKAGE_NAME
: Not a true "secret", but stored here to avoid someone pushing bogus packages to Docker Hub during CI testing from a fork- In a fork, set to a private name which differs from the production one
NPM_CI_TOKEN
: An "Automation"-type access token for NPM for theshaka-bot
account- To generate, visit https://www.npmjs.com/settings/shaka-bot/tokens and select the "Automation" type
NPM_PACKAGE_NAME
: Not a true "secret", but stored here to avoid someone pushing bogus packages to NPM during CI testing from a fork- In a fork, set to a private name which differs from the production one
Repo Settings
Each of these workflow features can be enabled by creating a "GitHub Environment" with the same name in your repo settings. Forks will not have these enabled by default.
debug
: enable debugging via SSH after a failureself_hosted
: enable self-hosted runners in the build matrix