Skip to content

Conversation

@Sewer56
Copy link
Member

@Sewer56 Sewer56 commented Dec 2, 2025

  • Extract artifact name generation to scripts/get-artifact-name.sh with named parameters
  • Refactor action.yml to use new artifact naming script instead of inline logic
  • Consolidate test-friendly-names.yml and test-unfriendly-names.yml into test-artifact-names.yml
  • Add comprehensive artifact name testing with 18 matrix combinations (9 targets × 2 friendly-name settings)
  • Rename test-build-workflow.yml to test-build-options.yml and remove redundant test jobs

- Extract artifact name generation to scripts/get-artifact-name.sh with named parameters
- Refactor action.yml to use new artifact naming script instead of inline logic
- Consolidate test-friendly-names.yml and test-unfriendly-names.yml into test-artifact-names.yml
- Add comprehensive artifact name testing with 18 matrix combinations (9 targets × 2 friendly-name settings)
- Rename test-build-workflow.yml to test-build-options.yml and remove redundant test jobs
Comment on lines +17 to +203
strategy:
matrix:
include:
# Linux targets - friendly names
- use-friendly-target-names: "true"
target: x86_64-unknown-linux-gnu
expected-binary-name: "test-crate-linux-x64"
expected-binary-symbols-name: "test-crate-linux-x64.symbols"
expected-library-name: "C-Library-test-crate-linux-x64"
expected-library-symbols-name: "C-Library-test-crate-linux-x64.symbols"
- use-friendly-target-names: "true"
target: i686-unknown-linux-gnu
expected-binary-name: "test-crate-linux-x86"
expected-binary-symbols-name: "test-crate-linux-x86.symbols"
expected-library-name: "C-Library-test-crate-linux-x86"
expected-library-symbols-name: "C-Library-test-crate-linux-x86.symbols"
- use-friendly-target-names: "true"
target: aarch64-unknown-linux-gnu
expected-binary-name: "test-crate-linux-arm64"
expected-binary-symbols-name: "test-crate-linux-arm64.symbols"
expected-library-name: "C-Library-test-crate-linux-arm64"
expected-library-symbols-name: "C-Library-test-crate-linux-arm64.symbols"
- use-friendly-target-names: "true"
target: armv7-unknown-linux-gnueabihf
expected-binary-name: "test-crate-linux-armv7-hf"
expected-binary-symbols-name: "test-crate-linux-armv7-hf.symbols"
expected-library-name: "C-Library-test-crate-linux-armv7-hf"
expected-library-symbols-name: "C-Library-test-crate-linux-armv7-hf.symbols"
# Linux targets - raw triples
- use-friendly-target-names: "false"
target: x86_64-unknown-linux-gnu
expected-binary-name: "test-crate-x86_64-unknown-linux-gnu"
expected-binary-symbols-name: "test-crate-x86_64-unknown-linux-gnu.symbols"
expected-library-name: "C-Library-test-crate-x86_64-unknown-linux-gnu"
expected-library-symbols-name: "C-Library-test-crate-x86_64-unknown-linux-gnu.symbols"
- use-friendly-target-names: "false"
target: i686-unknown-linux-gnu
expected-binary-name: "test-crate-i686-unknown-linux-gnu"
expected-binary-symbols-name: "test-crate-i686-unknown-linux-gnu.symbols"
expected-library-name: "C-Library-test-crate-i686-unknown-linux-gnu"
expected-library-symbols-name: "C-Library-test-crate-i686-unknown-linux-gnu.symbols"
- use-friendly-target-names: "false"
target: aarch64-unknown-linux-gnu
expected-binary-name: "test-crate-aarch64-unknown-linux-gnu"
expected-binary-symbols-name: "test-crate-aarch64-unknown-linux-gnu.symbols"
expected-library-name: "C-Library-test-crate-aarch64-unknown-linux-gnu"
expected-library-symbols-name: "C-Library-test-crate-aarch64-unknown-linux-gnu.symbols"
- use-friendly-target-names: "false"
target: armv7-unknown-linux-gnueabihf
expected-binary-name: "test-crate-armv7-unknown-linux-gnueabihf"
expected-binary-symbols-name: "test-crate-armv7-unknown-linux-gnueabihf.symbols"
expected-library-name: "C-Library-test-crate-armv7-unknown-linux-gnueabihf"
expected-library-symbols-name: "C-Library-test-crate-armv7-unknown-linux-gnueabihf.symbols"
# Windows targets - friendly names
- use-friendly-target-names: "true"
target: x86_64-pc-windows-msvc
expected-binary-name: "test-crate-windows-x64"
expected-binary-symbols-name: "test-crate-windows-x64.symbols"
expected-library-name: "C-Library-test-crate-windows-x64"
expected-library-symbols-name: "C-Library-test-crate-windows-x64.symbols"
- use-friendly-target-names: "true"
target: i686-pc-windows-msvc
expected-binary-name: "test-crate-windows-x86"
expected-binary-symbols-name: "test-crate-windows-x86.symbols"
expected-library-name: "C-Library-test-crate-windows-x86"
expected-library-symbols-name: "C-Library-test-crate-windows-x86.symbols"
- use-friendly-target-names: "true"
target: aarch64-pc-windows-msvc
expected-binary-name: "test-crate-windows-arm64"
expected-binary-symbols-name: "test-crate-windows-arm64.symbols"
expected-library-name: "C-Library-test-crate-windows-arm64"
expected-library-symbols-name: "C-Library-test-crate-windows-arm64.symbols"
# Windows targets - raw triples
- use-friendly-target-names: "false"
target: x86_64-pc-windows-msvc
expected-binary-name: "test-crate-x86_64-pc-windows-msvc"
expected-binary-symbols-name: "test-crate-x86_64-pc-windows-msvc.symbols"
expected-library-name: "C-Library-test-crate-x86_64-pc-windows-msvc"
expected-library-symbols-name: "C-Library-test-crate-x86_64-pc-windows-msvc.symbols"
- use-friendly-target-names: "false"
target: i686-pc-windows-msvc
expected-binary-name: "test-crate-i686-pc-windows-msvc"
expected-binary-symbols-name: "test-crate-i686-pc-windows-msvc.symbols"
expected-library-name: "C-Library-test-crate-i686-pc-windows-msvc"
expected-library-symbols-name: "C-Library-test-crate-i686-pc-windows-msvc.symbols"
- use-friendly-target-names: "false"
target: aarch64-pc-windows-msvc
expected-binary-name: "test-crate-aarch64-pc-windows-msvc"
expected-binary-symbols-name: "test-crate-aarch64-pc-windows-msvc.symbols"
expected-library-name: "C-Library-test-crate-aarch64-pc-windows-msvc"
expected-library-symbols-name: "C-Library-test-crate-aarch64-pc-windows-msvc.symbols"
# macOS targets - friendly names
- use-friendly-target-names: "true"
target: x86_64-apple-darwin
expected-binary-name: "test-crate-macos-x64"
expected-binary-symbols-name: "test-crate-macos-x64.symbols"
expected-library-name: "C-Library-test-crate-macos-x64"
expected-library-symbols-name: "C-Library-test-crate-macos-x64.symbols"
- use-friendly-target-names: "true"
target: aarch64-apple-darwin
expected-binary-name: "test-crate-macos-arm64"
expected-binary-symbols-name: "test-crate-macos-arm64.symbols"
expected-library-name: "C-Library-test-crate-macos-arm64"
expected-library-symbols-name: "C-Library-test-crate-macos-arm64.symbols"
# macOS targets - raw triples
- use-friendly-target-names: "false"
target: x86_64-apple-darwin
expected-binary-name: "test-crate-x86_64-apple-darwin"
expected-binary-symbols-name: "test-crate-x86_64-apple-darwin.symbols"
expected-library-name: "C-Library-test-crate-x86_64-apple-darwin"
expected-library-symbols-name: "C-Library-test-crate-x86_64-apple-darwin.symbols"
- use-friendly-target-names: "false"
target: aarch64-apple-darwin
expected-binary-name: "test-crate-aarch64-apple-darwin"
expected-binary-symbols-name: "test-crate-aarch64-apple-darwin.symbols"
expected-library-name: "C-Library-test-crate-aarch64-apple-darwin"
expected-library-symbols-name: "C-Library-test-crate-aarch64-apple-darwin.symbols"
runs-on: ubuntu-latest
steps:
- name: Checkout Action
uses: actions/checkout@v4

- name: Test binary artifact name
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target ${{ matrix.target }} \
--use-friendly-target-names ${{ matrix.use-friendly-target-names }} \
--artifact-type binary)
EXPECTED="${{ matrix.expected-binary-name }}"
echo "BINARY_ARTIFACT_NAME=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Binary artifact name correct: $ARTIFACT_NAME"

- name: Test binary-symbols artifact name
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target ${{ matrix.target }} \
--use-friendly-target-names ${{ matrix.use-friendly-target-names }} \
--artifact-type binary-symbols)
EXPECTED="${{ matrix.expected-binary-symbols-name }}"
echo "BINARY_SYMBOLS_ARTIFACT_NAME=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Binary symbols artifact name correct: $ARTIFACT_NAME"

- name: Test library artifact name
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target ${{ matrix.target }} \
--use-friendly-target-names ${{ matrix.use-friendly-target-names }} \
--artifact-type library)
EXPECTED="${{ matrix.expected-library-name }}"
echo "LIBRARY_ARTIFACT_NAME=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Library artifact name correct: $ARTIFACT_NAME"

- name: Test library-symbols artifact name
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target ${{ matrix.target }} \
--use-friendly-target-names ${{ matrix.use-friendly-target-names }} \
--artifact-type library-symbols)
EXPECTED="${{ matrix.expected-library-symbols-name }}"
echo "LIBRARY_SYMBOLS_ARTIFACT_NAME=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Library symbols artifact name correct: $ARTIFACT_NAME"

test-artifact-names-with-features:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 4 hours ago

To fix the problem, add a permissions: key to the workflow root, specifying the minimal permissions required. For workflows that only check out code and do not interact with issues, pull requests, or perform deploys or artifact uploads, contents: read is sufficient. This block should be placed after the name: or on: sections, and before jobs:. In this workflow's structure, adding it after the on: block is standard. No method, import, or definition is required, just YAML structure changes in .github/workflows/test-artifact-names.yml.

Suggested changeset 1
.github/workflows/test-artifact-names.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test-artifact-names.yml b/.github/workflows/test-artifact-names.yml
--- a/.github/workflows/test-artifact-names.yml
+++ b/.github/workflows/test-artifact-names.yml
@@ -12,6 +12,9 @@
       - "scripts/get-friendly-target-name.sh"
       - ".github/workflows/test-artifact-names.yml"
 
+permissions:
+  contents: read
+
 jobs:
   test-artifact-names:
     strategy:
EOF
@@ -12,6 +12,9 @@
- "scripts/get-friendly-target-name.sh"
- ".github/workflows/test-artifact-names.yml"

permissions:
contents: read

jobs:
test-artifact-names:
strategy:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +204 to +275
runs-on: ubuntu-latest
steps:
- name: Checkout Action
uses: actions/checkout@v4

- name: Test binary with features
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target x86_64-unknown-linux-gnu \
--features "feature1,feature2" \
--use-friendly-target-names true \
--artifact-type binary)
EXPECTED="test-crate-linux-x64-feature1,feature2"
echo "ARTIFACT_NAME_WITH_FEATURES=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Feature suffix correctly appended: $ARTIFACT_NAME"

- name: Test binary-symbols with features
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target x86_64-unknown-linux-gnu \
--features "feature1,feature2" \
--use-friendly-target-names true \
--artifact-type binary-symbols)
EXPECTED="test-crate-linux-x64-feature1,feature2.symbols"
echo "ARTIFACT_NAME_WITH_FEATURES=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Feature suffix correctly appended: $ARTIFACT_NAME"

- name: Test library with features
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target x86_64-unknown-linux-gnu \
--features "feature1,feature2" \
--use-friendly-target-names true \
--artifact-type library)
EXPECTED="C-Library-test-crate-linux-x64-feature1,feature2"
echo "ARTIFACT_NAME_WITH_FEATURES=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Feature suffix correctly appended: $ARTIFACT_NAME"

- name: Test library-symbols with features
shell: bash
run: |
ARTIFACT_NAME=$(./scripts/get-artifact-name.sh \
--crate-name test-crate \
--target x86_64-unknown-linux-gnu \
--features "feature1,feature2" \
--use-friendly-target-names true \
--artifact-type library-symbols)
EXPECTED="C-Library-test-crate-linux-x64-feature1,feature2.symbols"
echo "ARTIFACT_NAME_WITH_FEATURES=$ARTIFACT_NAME"
if [[ "$ARTIFACT_NAME" != "$EXPECTED" ]]; then
echo "::error::Expected '$EXPECTED' but got '$ARTIFACT_NAME'"
exit 1
fi
echo "Feature suffix correctly appended: $ARTIFACT_NAME"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 4 hours ago

The best way to fix this problem is to add an explicit permissions block to the workflow file .github/workflows/test-artifact-names.yml, either at the root level (to affect all jobs) or to the jobs that do not have their own specified permissions. Since none of the jobs appear to need write access—for example, they simply run shell scripts to verify artifact names—it is sufficient to set contents: read (the minimal required permission for most workflows that only need to read code). Place the block immediately before the jobs: key for best readability and maintainability. No other code or imports need to be changed; this is entirely a YAML config edit.

Suggested changeset 1
.github/workflows/test-artifact-names.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test-artifact-names.yml b/.github/workflows/test-artifact-names.yml
--- a/.github/workflows/test-artifact-names.yml
+++ b/.github/workflows/test-artifact-names.yml
@@ -12,6 +12,8 @@
       - "scripts/get-friendly-target-name.sh"
       - ".github/workflows/test-artifact-names.yml"
 
+permissions:
+  contents: read
 jobs:
   test-artifact-names:
     strategy:
EOF
@@ -12,6 +12,8 @@
- "scripts/get-friendly-target-name.sh"
- ".github/workflows/test-artifact-names.yml"

permissions:
contents: read
jobs:
test-artifact-names:
strategy:
Copilot is powered by AI and may make mistakes. Always verify output.
@Sewer56 Sewer56 merged commit 809322d into v1-master Dec 2, 2025
45 checks passed
@Sewer56 Sewer56 deleted the cleanup-our-tests branch December 2, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants