-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from felddy/enhancement/refactor
Refactor and add local use and tests of workflows
- Loading branch information
Showing
18 changed files
with
486 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: "CSV to JSON" | ||
|
||
# This workflow converts a comma-separated list of platforms to a JSON array. | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
csv: | ||
description: "Comma-separated list" | ||
required: true | ||
type: string | ||
outputs: | ||
json: | ||
description: "JSON array" | ||
value: ${{ jobs.convert.outputs.json }} | ||
|
||
jobs: | ||
convert: | ||
name: "Convert platforms CSV to JSON" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
json: ${{ steps.csv-to-json.outputs.json }} | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # tag=v2.6.1 | ||
with: | ||
egress-policy: block | ||
allowed-endpoints: > | ||
- name: Convert CSV to JSON | ||
id: csv-to-json | ||
run: | | ||
echo "json=$(echo -n ${{ inputs.csv }} | jq --raw-input --compact-output 'split(",")')" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: "Diagnostics" | ||
|
||
# This workflow outputs diagnostic information about the runner and the environment | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
diagnostics: | ||
name: "Diagnostics" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # tag=v2.6.1 | ||
with: | ||
egress-policy: block | ||
allowed-endpoints: > | ||
azure.archive.ubuntu.com:443 | ||
azure.archive.ubuntu.com:80 | ||
packages.microsoft.com:443 | ||
www.githubstatus.com:443 | ||
- name: Check GitHub Status | ||
uses: crazy-max/ghaction-github-status@df4d23a4977438215339cf0fafceda8d9af8a0e5 # tag=v4.0.0 | ||
with: | ||
overall_threshold: major | ||
packages_threshold: major_outage | ||
|
||
- name: Dump context | ||
uses: crazy-max/ghaction-dump-context@8b55fa205ab4530d36f787a4de1009afaaa7f3b4 # tag=v2.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ | |
## Python ## | ||
__pycache__ | ||
.mypy_cache | ||
.pytest_cache | ||
.python-version | ||
*.egg-info | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Stage 1: Set up the cross-compilation environment | ||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:latest AS xx | ||
|
||
# Base image for the build | ||
FROM --platform=$BUILDPLATFORM debian:bookworm AS build | ||
|
||
# Copy the xx scripts for setting up the cross-compilation environment | ||
COPY --from=xx / / | ||
|
||
# Install build dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
clang | ||
|
||
# Set up the working directory | ||
WORKDIR /workspace | ||
|
||
# Copy the C source file into the image | ||
COPY src/arch_info.c . | ||
|
||
# Compile the program for the target platform | ||
ARG TARGETPLATFORM | ||
RUN xx-apt install -y libc6-dev gcc | ||
RUN xx-clang --static -o arch_info arch_info.c | ||
|
||
# Stage 2: Create the final minimal output image | ||
FROM scratch | ||
|
||
# Copy the compiled binary from the build stage | ||
COPY --from=build /workspace/arch_info / | ||
|
||
# Set the entry point to the compiled binary | ||
ENTRYPOINT ["/arch_info"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[pytest] | ||
addopts = --capture=no --color=yes --runslow --verbose -rA | ||
|
||
log_cli = true | ||
log_cli_level = INFO | ||
|
||
markers = | ||
slow: marks tests as slow (deselect with '-m "not slow"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
--requirement requirements-test.txt | ||
ipython | ||
semver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
--requirement requirements.txt | ||
pre-commit | ||
-e .[test] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
setuptools | ||
wheel | ||
-e . |
Oops, something went wrong.