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

GitHub action: check for corresponding Yaml file #6

Merged
merged 12 commits into from
May 27, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,28 @@ jobs:
git commit -m "update README with new artifact url $ARTIFACT_URL"
git push
if: ${{ env.OWNER == 'SiEPIC'}}

- name: Create comment
uses: actions/github-script@v6
with:
script: |
const missingFilesList = process.env.missing_files_list;
const commentBody = `
### Draft merge:

Thank you for submitting your design.

Please download the merged layout and confirm (by responding in a Comment below) that your layout is correctly merged:

${ARTIFACT_URL}

Thank you!
`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});

122 changes: 122 additions & 0 deletions .github/workflows/merge_complete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Merge complete

# merge the layout after the pull request is approved
on:
pull_request_review:
types: [submitted]

jobs:
approved:
if: github.event.review.state == 'APPROVED'
runs-on: ubuntu-latest

steps:
- name: checkout repo content
uses: actions/checkout@v3
with:
# https://github.com/MestreLion/git-tools?tab=readme-ov-file#git-restore-mtime
fetch-depth: 0


- name: Restore original modification time of files based on the date of the most recent commit
uses: chetan/git-restore-mtime-action@v2

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: install Python packages
run: |
pip install klayout SiEPIC siepic_ebeam_pdk pandas

- name: run merge script
run: |
python merge/EBeam_merge.py

- name: move merge output files to new folder
run: |
output_files="EBeam.oas EBeam.txt"

IFS=' '

mkdir -p merge_output

for file in $output_files; do
cp "merge/$file" merge_output/
done

- name: upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload
with:
name: merge-files
path: merge_output/

- name: get artifact url
run: |
IFS='/' read -ra REPO <<< "$GITHUB_REPOSITORY"
OWNER="${REPO[0]}"
REPO_NAME="${REPO[1]}"
echo "Owner: $OWNER"
echo "Repository: $REPO_NAME"

RUN_ID=${{ github.run_id }}
ARTIFACT_ID=${{ steps.artifact-upload.outputs.artifact-id }}
ARTIFACT_URL="https://github.com/$OWNER/$REPO_NAME/actions/runs/$RUN_ID/artifacts/$ARTIFACT_ID"
echo "Artifact URL: $ARTIFACT_URL"

echo "ARTIFACT_URL=$ARTIFACT_URL" >> $GITHUB_ENV
echo "OWNER=$OWNER" >> $GITHUB_ENV

- name: update url in runner README
run: |
start_delim="<!-- start-link -->"
end_delim="<!-- end-link -->"

# remove current URL
sed -i "/$start_delim/,/$end_delim/d" README.md

# add new URL
printf "$start_delim\n$ARTIFACT_URL\n$end_delim\n" >> README.md

# after a PR is merged into SiEPIC
- name: commit and push changes to README if we are in SiEPIC repo
run: |
git pull origin main
git diff
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add README.md
git commit -m "update README with new artifact url $ARTIFACT_URL"
git push
if: github.repository_owner == 'SiEPIC'


- name: Create comment
uses: actions/github-script@v6
with:
script: |
const missingFilesList = process.env.missing_files_list;
const commentBody = `
### Layout merged:

Thank you for submitting your design.

Your design has been accepted and merged!

Please download the merged layout and double-check that your layout is correctly merged:

${ARTIFACT_URL}

Thank you!
`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});

25 changes: 10 additions & 15 deletions .github/workflows/yaml_file.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: Check GDS and YAML Files
name: Check for the presence of a corresponding YAML file(s)

on:
push:
paths:
- '**/*.gds'
- '**/*.GDS'
- '**/*.oas'
- '**/*.OAS'
pull_request:
paths:
- '**/*.gds'
- '**/*.GDS'
- '**/*.oas'
- '**/*.OAS'
types: [opened, synchronize]

jobs:
check_files:
Expand All @@ -27,7 +22,7 @@ jobs:
id: changed_files
run: |
echo "Changed files:"
git diff --name-only HEAD~1 > changed_files.txt
git diff --name-only --diff-filter=d HEAD~1 > changed_files.txt
cat changed_files.txt

- name: Filter .gds and .oas files
Expand All @@ -50,7 +45,7 @@ jobs:
else
echo "Missing YAML file for $design_file"
missing_yaml_files=$((missing_yaml_files + 1))
missing_files_list="$missing_files_list\n- $design_file"
missing_files_list="$missing_files_list $design_file"
fi
done < design_files.txt

Expand All @@ -65,17 +60,17 @@ jobs:
script: |
const missingFilesList = process.env.missing_files_list;
const commentBody = `
### Missing Corresponding YAML Files
### Missing Corresponding YAML Files

The following design files (.gds or .oas) are missing their corresponding .yaml files:
The following design files (.gds or .oas) are missing their corresponding .yaml files:

${missingFilesList}
${missingFilesList}

The YAML file is a test sequence format. It's important to think about testing during the design process (Design for Test). Including a test sequence helps ensure that the design can be effectively validated and verified. Please make sure to include the necessary .yaml files to facilitate this.
The YAML file is used to describe an automated test sequence. It is important to think about testing during the design process (Design for Test). Including a test sequence helps ensure that the design can be effectively validated and verified. Please make sure to include the necessary .yaml files to facilitate this.

For more information, refer to the [SiEPIC Testcreator](https://github.com/SiEPIC/SiEPIC_testcreator) repository.
For more information on how to create the test sequence, please refer to the [SiEPIC Testcreator](https://github.com/SiEPIC/SiEPIC_testcreator) repository.

Thank you!
Thank you!
`;

github.rest.issues.createComment({
Expand Down
File renamed without changes.
Loading
Loading