Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Workflows #232

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
865047b
Update website and zine (Zig 0.13) and fix broken links
MatthiasPortzel Aug 1, 2024
7318341
Use cpp for syntax highlighting
MatthiasPortzel Aug 2, 2024
70f2860
chore: cleanup website files
EliSauder Jul 24, 2024
b0c76d6
chore: removed outdated .buildkit pipeline from regz project
EliSauder Jul 24, 2024
6e43041
chore: removed empty .gitignore from regz project
EliSauder Jul 24, 2024
db65a88
ci: add publish and build reusable workflows
EliSauder Jul 24, 2024
4701fc7
ci: implement build pipeline and patch to zig master
EliSauder Jul 26, 2024
36645e5
feat(ci): re-enable windows/macos build
EliSauder Jul 28, 2024
d8d58af
chore: removed LICENSE references from sub projects
EliSauder Jul 28, 2024
abdafc4
feat(ci): macos now actually runs build when packaged
EliSauder Jul 28, 2024
7da4763
ci: working publish workflows
EliSauder Aug 21, 2024
1774d88
ci: better names for secret and commit message
EliSauder Aug 22, 2024
931fc3a
feat: removed dependency on separate PAT
EliSauder Aug 24, 2024
b33a896
refactor: removed unneeded submodule
EliSauder Aug 24, 2024
c2ae647
fix: return to a PAT/TOKEN for PR creation
EliSauder Aug 25, 2024
4099ade
docs(ci): add comments to clarify why a custom token is used
EliSauder Aug 25, 2024
4f47c5f
fix: workflow_run to get around workflows not triggered by workflows
EliSauder Aug 25, 2024
d5aa89c
feat(ci): handle version overridding
EliSauder Aug 25, 2024
70ed75f
ci: add initial website ci
EliSauder Aug 27, 2024
f2babae
feat: website*microzig publish with artifact restructuring
EliSauder Sep 14, 2024
628ec92
feat: move target zig version to variable
EliSauder Sep 23, 2024
c3ffd83
ci: implement build pipeline and patch to zig master
EliSauder Jul 26, 2024
59ae4f2
fix: resolve merge conflicts
EliSauder Sep 23, 2024
64ce03a
chore: move release step generation to function
EliSauder Sep 23, 2024
f4918db
fix: tools source not published
EliSauder Sep 23, 2024
00fe8be
chore: cleanup/doc comments
EliSauder Sep 23, 2024
2522528
chore: rename bsp -> port in workflows
EliSauder Oct 5, 2024
f4d91a9
chore: remove file from build
EliSauder Oct 5, 2024
23c52cc
chore: revert secret naming to not care about mz/ws
EliSauder Oct 7, 2024
85d4245
feat: simplify workflows
EliSauder Oct 26, 2024
f1fd83c
fix: removed reference to alter build artifact in publish yaml
EliSauder Oct 26, 2024
9ccde0c
feat: removed path filters on workflow triggers
EliSauder Oct 31, 2024
956f386
chore: removed test files
EliSauder Nov 1, 2024
097fe70
feat: handle any semver prerelease format
EliSauder Nov 1, 2024
51fd09c
feat: move to a single TARGET_ZIG_VERSION
EliSauder Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions .github/workflows/build-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: Reusable zig build workflow

on:
workflow_call:
inputs:
zig-version:
required: false
type: string
default: 0.13.0
description: Version of zig to build with
get-submodules:
required: false
type: string
default: false
description: Whether or not to clone submodules
sparse-checkout-patterns:
required: false
type: string
default: ""
description: |
List of file patterns (globs) to include in the sparse checkout.
If empty, sparse checkout is not used.
working-directory:
required: false
type: string
default: "."
description: |
If building a sub-project only, you can specify a working directory
which is the path to that sub-project.
target-os:
required: false
type: string
default: ""
description: |
If you need to filter which platform uploads the artifact.
is-packaged:
required: false
type: boolean
default: false
description: |
Whether or not to use a provided package command. This is specifically
to output the boxzer output.
# The github artifact name for uploading build artifacts to
# If it is blank, nothing will be uploaded
github-artifact-name:
required: false
type: string
default: ""
description: |
The name to use for the github actifact that will be uploaded.
# The path that we should upload artifacts from
artifact-output-path:
required: false
type: string
default: ""
description: |
The path to the generated artifact that will be included within
the github artifact upload.
ref:
required: false
type: string
default: ""
description: A sepcific ref to build for (i.e. a version or commit)
zig-args:
required: false
type: string
default: ""
description: Arguments to add to the zig build command
secrets:
# The downloads url for the packaging step. This is used in boxzer to
# fill in the manifest downloads location
downloads-url:
required: false
description: |
The download url that will be included in the boxzer manifest output.
If the "is-packaged" option is false, this will not be used.
outputs:
issemver:
description: Whether or not it was built with a semver
value: ${{ jobs.build-zig.outputs.issemver }}
major:
description: The major version of the semver
value: ${{ jobs.build-zig.outputs.major }}
minor:
description: The minor version of the semver
value: ${{ jobs.build-zig.outputs.minor }}
patch:
description: The patch version of the semver
value: ${{ jobs.build-zig.outputs.patch }}
prerelease:
description: The prerelease info of the semver
value: ${{ jobs.build-zig.outputs.prerelease }}
build:
description: The build info of the semver
value: ${{ jobs.build-zig.outputs.build }}
version:
description: The full semver string
value: ${{ jobs.build-zig.outputs.version }}

jobs:
build-zig:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
outputs:
issemver: ${{ steps.semver.outputs.issemver }}
major: ${{ steps.semver.outputs.major }}
minor: ${{ steps.semver.outputs.minor }}
patch: ${{ steps.semver.outputs.patch }}
prerelease: ${{ steps.semver.outputs.prerelease }}
build: ${{ steps.semver.outputs.build }}
version: ${{ steps.semver.outputs.version }}
steps:
# If we just want to use the current commit, simply run a checkout
- name: Checkout
if: ${{ inputs.ref == '' }}
uses: actions/checkout@v4
with:
sparse-checkout: ${{ inputs.sparse-checkout-patterns }}
submodules: ${{ inputs.get-submodules }}
# If there is a specific ref we want, check that ref out.
- name: Checkout Specific Ref
if: ${{ inputs.ref != '' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
sparse-checkout: ${{ inputs.sparse-checkout-patterns }}
submodules: ${{ inputs.get-submodules }}
# Parse the reference and pull out the semversion information if it is semversion
- name: Get Semver Details
shell: bash
id: semver
run: |
# This regex is from the semver page. Yes, I too cry at how big it is, just be glad you didn't have to get it working in bash.
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
if [[ "${{ inputs.ref }}" =~ ^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))? ]]; then
echo "issemver=true" >> "$GITHUB_OUTPUT"
echo "major=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
echo "minor=${BASH_REMATCH[2]}" >> "$GITHUB_OUTPUT"
echo "patch=${BASH_REMATCH[3]}" >> "$GITHUB_OUTPUT"
echo "prerelease=${BASH_REMATCH[5]}" >> "$GITHUB_OUTPUT"
echo "build=${BASH_REMATCH[10]}" >> "$GITHUB_OUTPUT"
echo "version=$(echo "${{ inputs.ref }}" | sed 's/^v\(.*\)/\1/')" >> "$GITHUB_OUTPUT"
else
echo "issemver=false" >> "$GITHUB_OUTPUT"
fi
# If the reference is semver, modify all zon files to include the version from the reference
# Mac needs to be done different than windows/linux (see the sed command)
- name: Process Version Info
if: steps.semver.outputs.issemver == 'true' && runner.os != 'macOS'
shell: bash
run: |
find . -name "*.zig.zon" -exec sed -i 's/\(.version *= *"\)[^\s]*\(",\)/\1${{ steps.semver.outputs.version }}\2/' {} \;
- name: Process Version Info - Mac
if: steps.semver.outputs.issemver == 'true' && runner.os == 'macOS'
shell: bash
run: |
find . -name "*.zig.zon" -exec sed -i '' 's/\(.version *= *"\)[^\s]*\(",\)/\1${{ steps.semver.outputs.version }}\2/' {} \;
# Setup zig, we use mlugg's setup because it has caching
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ inputs.zig-version }}
# Build/Package the project. The working directory is for building
# sub-projects.
- name: Build
run: |
zig build ${{ inputs.zig-args }}
working-directory: ./${{ inputs.working-directory }}
- name: Package
if: ${{ inputs.is-packaged && runner.os == 'macOS' }}
run: zig build package -- "${{ secrets.downloads-url }}"
working-directory: ./${{ inputs.working-directory }}
# We use whether or not an artifact output path is provided and whether
# or not there is actually anything in that directory to know whether or
# not there is anything to upload.
- name: Get Should Upload bash
id: should-upload
shell: bash
run: |
if [[ ! -z "${{ inputs.artifact-output-path }}" ]] \
&& test -n "$(find ${{ inputs.artifact-output-path }} -maxdepth 1 \
-print -quit)"; then
echo "SHOULD_UPLOAD=true" >> $GITHUB_OUTPUT;
else
echo "SHOULD_UPLOAD=false" >> $GITHUB_OUTPUT;
fi
# Upload artifacts if there is something to upload and if there is a
# name to upload it to
- name: Upload Artifacts
if: |
steps.should-upload.outputs.SHOULD_UPLOAD == 'true'
&& inputs.github-artifact-name != ''
&& ( runner.os == inputs.target-os || inputs.target-os == '' )
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.github-artifact-name }}
path: ${{ inputs.artifact-output-path }}
24 changes: 24 additions & 0 deletions .github/workflows/build-microzig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Microzig

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-microzig:
if: |
${{
( github.event_name == 'pull_request' && github.base_ref == 'main' )
|| github.ref_name == 'main'
}}
name: Build
uses: ./.github/workflows/build-base.yml
with:
zig-version: ${{ vars.TARGET_ZIG_VERSION }}
get-submodules: true
is-packaged: true
zig-args: -Doptimize=ReleaseSmall
secrets:
downloads-url: ${{ secrets.DOWNLOADS_URL }}
55 changes: 0 additions & 55 deletions .github/workflows/build.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/deploy.yml

This file was deleted.

Loading
Loading