Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 15 additions & 49 deletions .github/actions/rust-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,31 @@ inputs:
git_token:
description: 'Token to authenticate for git'
required: false
runner:
description: 'Runner to use for CI'
arm64:
default: "ubicloud-standard-8-arm"
required: false
amd64:
default: "ubicloud-standard-4"
required: false

outputs:
config:
description: 'Configuration JSON output'
value: ${{ steps.merge.outputs.config }}
value: ${{ steps.config.outputs.config }}
runs:
using: composite
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
token: ${{ inputs.git_token || github.token }}
- name: Check if yq exists
id: check-yq
shell: bash
run: |
if command -v yq &> /dev/null; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Setup yq
if: steps.check-yq.outputs.exists == 'false'
uses: carteramesh/ci/.github/actions/install-yq@main
- name: Merge YAML configs
- name: generate
id: generate
uses: carteramesh/ci@main
- name: replace runners
id: config
shell: bash
run: |
shopt -s nullglob
BRANCH_ACTION_CONFIG=""
BRANCH_CONFIG=""
if [ -d "${{ github.action_path }}/../../ci-configs/rust" ]; then
BRANCH_ACTION_CONFIG="${{ github.action_path }}/../../ci-configs/rust/*.yml"
fi
if [ -d "../../ci-configs/$GITHUB_REF_NAME" ]; then
BRANCH_CONFIG="../../ci-configs/$GITHUB_REF_NAME/rust*.yml"
fi
echo "BRANCH_ACTION_CONFIG=$BRANCH_ACTION_CONFIG"
echo "BRANCH_CONFIG=$BRANCH_CONFIG"
ls $BRANCH_ACTION_CONFIG || echo no branch action config files found
[ -n "$BRANCH_CONFIG" ] && ls $BRANCH_CONFIG || echo no repo branch config files found
ls .github/ci-configs/*.yml || echo no repo config files find
DUMMY=""
if [ -f .github/ci-configs/dummy.yml ]; then
DUMMY=".github/ci-configs/dummy.yml"
echo found dummy config for testing
fi
yq eval-all '. as $item ireduce ({}; . * $item)' \
"${{ github.action_path }}/../../ci-configs/rust-default.yml" \
$BRANCH_ACTION_CONFIG \
$BRANCH_CONFIG \
.github/ci-configs/rust*.yml \
$DUMMY \
-o json > merged.json
- name: merge
id: merge
uses: carteramesh/ci@main
with:
config: merged.json
runner: ${{ inputs.runner }}
CONFIG="$(echo '${{ steps.generate.outputs.config }}' | sed \
-e 's/vars.RUNNER_ARM64/${{ inputs.arm64 }}/g' \
-e 's/vars.RUNNER_AMD64/${{ inputs.amd64 }}/g')"
echo "config=$CONFIG" >> $GITHUB_OUTPUT
5 changes: 5 additions & 0 deletions .github/rust-ci.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createRustWorkflow } from '@carteramesh/ci';

export default function () {
return createRustWorkflow().semver(false).build();
}
77 changes: 0 additions & 77 deletions .github/workflows/action-check-dist.yml

This file was deleted.

72 changes: 7 additions & 65 deletions .github/workflows/action-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,31 @@ on:
permissions:
contents: read
jobs:
test-typescript:
name: TypeScript Tests
runs-on: ${{ vars.RUNNER }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6
- name: Setup Node.js
id: setup-node
uses: ubicloud/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Dependencies
id: npm-ci
run: npm ci
- name: Test
id: npm-ci-test
run: npm run ci-test
test-action:
name: Actions Test / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ${{ vars.RUNNER }}
- windows-latest
- ${{ vars.RUNNER_ARM64 }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6
- name: Check if yq exists
id: check-yq
shell: bash
run: |
if command -v yq &> /dev/null; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Setup yq
if: steps.check-yq.outputs.exists == 'false'
uses: carteramesh/ci/.github/actions/install-yq@main
- name: Merge YAML configs
shell: bash
run: |
yq eval-all '. as $item ireduce ({}; . * $item)' \
.github/ci-configs/rust-default.yml \
.github/ci-configs/rust/*.yml \
.github/ci-configs/test/*.yml \
-o json > merged.json
- name: Test Local Action
id: test-action
uses: ./
with:
config: merged.json
runner: ${{ matrix.os }}
- name: Print Output
id: output
shell: bash
run: |
echo '${{ steps.test-action.outputs.config }}' | jq .
runner="${{ fromJSON(steps.test-action.outputs.config).runner }}"
rustlog="${{ fromJSON(steps.test-action.outputs.config).global.rustlog }}"
packages="${{ fromJSON(steps.test-action.outputs.config).global.packages.Linux }}"
pages="${{ fromJSON(steps.test-action.outputs.config).pages.mdbook.if }}"
if [ "$runner" != "${{ matrix.os }}" ]; then
echo "Runner mismatch ${runner} != ${{ matrix.os }}"
exit 1
fi
if [ "$rustlog" != "debug" ]; then
echo "Rust log level mismatch ${rustlog} != debug"
exit 1
fi
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "$packages" != "curl" ]; then
echo "mismatch ${packages} != curl"
exit 1
fi
fi
echo $packages
# pages="${{ fromJSON(steps.test-action.outputs.config).pages.mdbook.if }}"

if [ "$pages" != "false" ]; then
echo "pages should be false"
exit 1
fi
# if [ "$pages" != "false" ]; then
# echo "pages should be false"
# exit 1
# fi
38 changes: 0 additions & 38 deletions .github/workflows/action-linter.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/dummy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ on:
required: false
jobs:
releaser:
if: true
name: release
uses: ./.github/workflows/rust-release.yml
secrets: inherit
with:
runner: ${{ vars.RUNNER }}
version: ${{ inputs.version }}
package: 'dummy'
2 changes: 1 addition & 1 deletion .github/workflows/dummy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
push:
branches: [main]
pull_request:

jobs:
verify:
if: true
name: dummy
uses: ./.github/workflows/rust.yml
secrets: inherit
Expand Down
Loading
Loading