Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
14f4af1
feat: :sparkles: Initial Commit - Add initial build action and Docker…
ABUCKY0 Mar 12, 2025
4c71528
feat: :sparkles: Update workflows to do moer autonomously and reset b…
ABUCKY0 Mar 12, 2025
17f76c4
fix: :sparkles: Update repository, ref, and caller_token inputs to work.
ABUCKY0 Mar 12, 2025
963d667
feat: :sparkles: Update test workflow to use Docker for action execution
ABUCKY0 Mar 12, 2025
3ed09ed
fix: :bug: Maybe fix Error: Repository path '/ZestCodeCloned' is not …
ABUCKY0 Mar 12, 2025
65b92fe
fix: :bug: Correct directory in test workflow
ABUCKY0 Mar 12, 2025
addb466
test: list all files in the directory
ABUCKY0 Mar 12, 2025
f89ff19
test: :bug: Remove meson build commands so list directory command may…
ABUCKY0 Mar 12, 2025
849fb0b
fix: :bug: Update Docker command in test workflow to actually change …
ABUCKY0 Mar 12, 2025
bfbe1a9
fix: :bug: Change docker run command to maybe correct path
ABUCKY0 Mar 12, 2025
1c0f1ba
fix: :bug: Update paths in test workflow for Docker command
ABUCKY0 Mar 12, 2025
deec299
fix: :bug: Update Docker paths in test workflow
ABUCKY0 Mar 12, 2025
9c20f51
refactor: :sparkles: Replace shell script with Python build script an…
ABUCKY0 Mar 13, 2025
cfeb824
fix: :bug: Change Dockerfile entrypoint to CMD instead of RUN
ABUCKY0 Mar 13, 2025
2da63d3
ci: :bug: Fix continue-on-error input not existing by manually settin…
ABUCKY0 Mar 13, 2025
24af438
fix: :bug: Initialize setup_output and compile_output before try-cat…
ABUCKY0 Mar 13, 2025
1e1ef10
fix: :bug: Update LICENSE path in Dockerfile and build script; declar…
ABUCKY0 Mar 13, 2025
ae1ed09
fix: :bug: Correctly declare global variables
ABUCKY0 Mar 13, 2025
261ac2c
fix: :bug: Actually fix global variables
ABUCKY0 Mar 13, 2025
7ea6d5b
fix: :bug: Declare global variables for setup_output, compile_output,…
ABUCKY0 Mar 13, 2025
10671b9
fix: :bug: Test to see if the python script is running meson or othe…
ABUCKY0 Mar 13, 2025
88b6574
fix: :bug: Capture output in meson setup command instead of redirecti…
ABUCKY0 Mar 13, 2025
af85db0
fix: :bug: Enable unbuffered output for Python and capture output in …
ABUCKY0 Mar 13, 2025
4215bc4
fix: :bug: Print stdout and stderr output for meson setup and compile…
ABUCKY0 Mar 13, 2025
bf64d92
fix: :bug: Ensure stdout and stderr are printed after meson setup and…
ABUCKY0 Mar 13, 2025
0a950d2
fix: :bug: Update meson setup and compile commands to handle errors a…
ABUCKY0 Mar 13, 2025
abc17f7
fix: :bug: Remove unnecessary decoding of stdout output in build script
ABUCKY0 Mar 13, 2025
adedba9
refactor: :fire: Switch back from python to bash shell script
ABUCKY0 Mar 14, 2025
7b2bad6
ci: :bug: switch to main from build/meson-init in test action
ABUCKY0 Mar 14, 2025
656754f
fix: :bug: Correctly capture exit code from meson setup for error han…
ABUCKY0 Mar 14, 2025
2a9c46d
fix: :bug: Replace 'Dockerfile' in action.yml with the loaded tag fro…
ABUCKY0 Mar 14, 2025
21ad29b
fix: :bug: Ensure GH_SUMMARY_OUTPUT actually written to GITHUB_STEP_S…
ABUCKY0 Mar 14, 2025
a4029b3
refactor: :bug: Add logging for Meson setup and compile exit codes
ABUCKY0 Mar 14, 2025
d5fd1e7
refactor: :bug: Simplify disable-errors and enable-errors in build sc…
ABUCKY0 Mar 14, 2025
860e6be
fix: Reorder when I get the exit code from meson
ABUCKY0 Mar 14, 2025
b92c51c
refactor: :art: Change builddir to build in meson commands
ABUCKY0 Mar 14, 2025
a120acc
refactor: :art: Make meson compile verbosely
ABUCKY0 Mar 14, 2025
b2e716e
refactor: :beers: Don't purge parts of the toolchain to see if code c…
ABUCKY0 Mar 14, 2025
336cf23
refactor: :fire: burn fp in the pit of hell, and place simd on the th…
ABUCKY0 Mar 14, 2025
c35f454
refactor: :bug: Write directly to github step summary instead of to a…
ABUCKY0 Mar 14, 2025
d4162c3
refactor: :art: Remove verbose flag from meson compile command
ABUCKY0 Mar 14, 2025
7e5f299
style: :bulb: Add comment highlighting with prefixed defined by the B…
ABUCKY0 Mar 14, 2025
8ac9f12
fix: :bug: Fix Step Summary not being written by removing definiton o…
ABUCKY0 Mar 14, 2025
5c29886
fix: :bug: Use cat instead of echo to write stdout output to summary.
ABUCKY0 Mar 14, 2025
90bd2b7
fix: :bug: Add spacing to GitHub step summary so formatting will actu…
ABUCKY0 Mar 14, 2025
4fadc66
feat: :sparkles: add write_job_summary input
ABUCKY0 Mar 14, 2025
89a51d8
fix: :bug: Replace alias with functions for error handling in build s…
ABUCKY0 Mar 14, 2025
12343ee
ci: :bug: (Maybe?) Correct syntax error in build-image.yml
ABUCKY0 Mar 14, 2025
1dc969b
revert: :green_heart: Undo syntax change since it caused a different …
ABUCKY0 Mar 14, 2025
43a2c76
ci: :green_heart: Maybe fix build-image workflow (fr this time)
ABUCKY0 Mar 14, 2025
8c8c4f0
ci: 💚 Correct repository format in build-image.yml, possibly fixing b…
ABUCKY0 Mar 14, 2025
72186d6
ci: :green_heart: fix CI build (Hopefully actually fr this time)
ABUCKY0 Mar 14, 2025
a73f1b5
fix: :bug: Make the write_job_summary input actually work
ABUCKY0 Mar 14, 2025
18516fb
fix: :bug: Fix conditional check for INPUT_WRITE_JOB_SUMMARY
ABUCKY0 Mar 14, 2025
18e610e
fix: :bug: Add write_job_summary input to Test Action in test.yml
ABUCKY0 Mar 14, 2025
3920da6
test: :bug: Add debugging output for Meson setup exit code in build.sh
ABUCKY0 Mar 14, 2025
e731f34
docs: :memo: Start filling out README.md
ABUCKY0 Mar 17, 2025
5981594
ci: :sparkles: Add Upload_Image job to build-image.yml and upload bin…
ABUCKY0 Mar 17, 2025
a10e40d
ci: :fire: Disable binary uploading step
ABUCKY0 Mar 17, 2025
db0fb07
ci: :sparkles: Update job names in build-image.yml and test.yml
ABUCKY0 Mar 17, 2025
4ba928d
ci: :sparkles: Update job name format in test.yml for clarity
ABUCKY0 Mar 17, 2025
72f84c9
refactor: :art: Remove all mentions of pros and commented out code
ABUCKY0 Mar 17, 2025
dfd605e
fix: ✂️change v7-a* to v7-a+simd in Dockerfile
ABUCKY0 Mar 18, 2025
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
160 changes: 160 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Build Container Image & Test

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
# Publish semver tags as releases.
tags: ["v*.*.*"]
paths-ignore:
- "README.md"
branches: [ "**" ]
pull_request:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Build_Container:
name: Build Docker Container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}s
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build Docker image
id: buildandpush
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Add Environment Variables
id: env
run: |
echo "GH_PULLREQ_NUM=${{ github.event.number }}" >> $GITHUB_ENV
echo "GH_EEVENT_NAME=${{ github.event_name }}" >> $GITHUB_ENV
echo "GH_RREPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
- name: Create Tar Image For Upload
id: tar
run: |
docker images
tag=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
echo $tag
docker save -o image.tar $tag

- name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: image.tar
path: image.tar
retention-days: 1 # One Day (The Minimum)
outputs:
prnum: ${{ github.event.number }}
url: ${{ steps.upload.outputs.artifact-url }}
tag: ${{ env.IMAGE_NAME }}
artifact_id: ${{ steps.upload.outputs.artifact-id }}

Test_Action:
name: Test Docker Container/GitHub Action
needs: Build_Container
uses: ./.github/workflows/test.yml
strategy:
fail-fast: true
matrix:
write_job_summary: [true, false]
repository: ["ZestCommunity/ZestCode"]
ref: ["main"]
caller_token: ["${{ github.token }}"]
with:
write_job_summary: ${{ matrix.write_job_summary }}
repository: ${{ matrix.repository }}
ref: ${{ matrix.ref }}
caller_token: ${{ matrix.caller_token }}

Upload_Image:
name: Upload Docker Image to ghcr.io Registry
permissions:
contents: read
packages: write
needs:
[
Build_Container,
Test_Action
]
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Image
uses: actions/download-artifact@v4
with:
name: image.tar
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Load Image
id: load
run: |
echo "tag=$(docker load -i ./image.tar | grep -oP 'Loaded image: \K.*' | tr '\n' ' ')" > $GITHUB_OUTPUT
- name: Push the image
if: ${{ github.event_name != 'pull_request' }}
run: |
for tag in $(echo "${{ steps.load.outputs.tag }}" | tr ' ' '\n'); do
echo "$tag"
docker push "$tag"
done
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Tests
on:
workflow_call:
inputs:
repository:
description: The github repository to checkout
required: true
type: string
ref:
description: The ref of the github repository to checkout
required: true
type: string
caller_token:
description: "The token of the caller"
required: true
type: string
write_job_summary:
description: Whether to write the artifact URL to the job summary
default: true
type: boolean

jobs:
test:
name: "Testing Container: Write Job Summary?${{ inputs.write_job_summary }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}

- name: Checkout
uses: actions/checkout@v4
with:
path: ./action/
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: image.tar
github-token: ${{ inputs.caller_token }}

- name: Load Image
id: load
run: |
echo "tag=$(docker load -i ./image.tar | grep -oP 'Loaded image: \K.*' | head -n 1)" > $GITHUB_OUTPUT

- name: Edit Action.yml With Local Image
run: |
cat action/action.yml
sed -i "s|docker://ghcr.io/.*/build-action:[^\']*|docker://${{steps.load.outputs.tag}}|g" action/action.yml
sed -i "s|Dockerfile|docker://${{steps.load.outputs.tag}}|g" action/action.yml
cat action/action.yml

- name: Test Action
id: test-action
uses: ./action/
continue-on-error: False
with:
write_job_summary: ${{ inputs.write_job_summary }}
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ------------
# Build Stage: Get Dependencies
# ------------
FROM alpine:latest AS get-dependencies
LABEL stage=builder

LABEL org.opencontainers.image.description="A ZestCode Build Container"
LABEL org.opencontainers.image.source=https://github.com/ZestCommunity/build-action
LABEL org.opencontainers.image.licenses=MIT

# Install Required Packages and ARM Toolchain
RUN apk add --no-cache bash
RUN mkdir "/arm-none-eabi-toolchain" && wget -O- "https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz" \
| tar Jxf - -C "/arm-none-eabi-toolchain" --strip-components=1
RUN <<-"EOF" bash
set -e

toolchain="/arm-none-eabi-toolchain"
mkdir -p "$toolchain"

rm -rf "$toolchain"/{share,include}
rm -rf "$toolchain"/lib/gcc/arm-none-eabi/13.3.1/arm
rm -f "$toolchain"/bin/arm-none-eabi-{gdb,gdb-py,cpp,gcc-13.3.1}

find "$toolchain"/arm-none-eabi/lib/thumb -mindepth 1 -maxdepth 1 ! -name 'v7-a+simd' -exec rm -rf {} +
find "$toolchain"/lib/gcc/arm-none-eabi/13.3.1/thumb -mindepth 1 -maxdepth 1 ! -name 'v7-a+simd' -exec rm -rf {} +
find "$toolchain"/arm-none-eabi/include/c++/13.3.1/arm-none-eabi/thumb -mindepth 1 -maxdepth 1 ! -name 'v7-a+simd' -exec rm -rf {} +

apk cache clean # Cleanup image
EOF
# ------------
# Runner Stage
# ------------
FROM alpine:latest AS runner
LABEL stage=runner
LABEL org.opencontainers.image.description="A ZestCode Build Container"
LABEL org.opencontainers.image.source=https://github.com/ZestCommunity/build-action
LABEL org.opencontainers.image.licenses=MIT
# Copy dependencies from get-dependencies stage
COPY --from=get-dependencies /arm-none-eabi-toolchain /arm-none-eabi-toolchain
RUN apk add --no-cache gcompat libc6-compat libstdc++ git gawk python3 pipx unzip bash && pipx install meson ninja && apk cache clean

# Set Environment Variables
ENV PATH="/arm-none-eabi-toolchain/bin:/root/.local/bin:${PATH}"

ENV PYTHONUNBUFFERED=1

COPY build-tools/build.sh /build.sh
RUN chmod +x /build.sh
COPY LICENSE /LICENSE

ENTRYPOINT ["/build.sh"]
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# build-action
# ZestCode Build Action
An automated build action for ZestCode projects.

## Usage:
### Example:
```yml
name: ZestCode Build Action Example

on:
push:
branches: "**"
pull_request:
branches: "**"

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Build Action
id: test
uses: ZestCommunity/build-action@main
```
### Inputs:
> `write_job_summary`
> - **Whether to output to GitHub's Job Summary**
> - Required: False
> - Default: True

## Notes
This container was based on LemLib/pros-build.
20 changes: 20 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Zest Build Action'
description: 'Automatically build ZestCode templates'
branding:
color: 'blue'
icon: 'box'
colorized: true

inputs:
write_job_summary:
required: false
default: true
description: Whether to create a GitHub job summary

outputs:
name:
description: 'The recommended name for the artifact.'

runs:
using: 'Docker'
image: 'Dockerfile'
Loading