diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 6020ede..bd7a4ff 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -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 + }); + diff --git a/.github/workflows/merge_complete.yml b/.github/workflows/merge_complete.yml new file mode 100644 index 0000000..0db8ebd --- /dev/null +++ b/.github/workflows/merge_complete.yml @@ -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="" + end_delim="" + + # 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 + }); + diff --git a/submissions/test.gds b/submissions/test.gds new file mode 100644 index 0000000..782a3b5 Binary files /dev/null and b/submissions/test.gds differ diff --git a/submissions/test.yaml b/submissions/test.yaml new file mode 100644 index 0000000..56690a9 --- /dev/null +++ b/submissions/test.yaml @@ -0,0 +1,226 @@ +Devices: + BraggGratingwithHeater,comment,comment: + DeviceID: BraggGratingwithHeater,comment,comment + Electrical Coordinates: [] + Optical Coordinates: + - 50.0 + - 303.0 + Polarization: TE + RoutineCheck: true + Routines: + - Set Wavelength Voltage Sweep:VoltageSweep_1480,1500,1530,1550 + - Set Wavelength Current Sweep:CurrentSweep_1480,1500,1550 + - Set Voltage Wavelength Sweep:WavelengthSweep_0.1,0.2,0.3 + Type: device + Wavelength: '1550' +Routines: + Current Sweep: + Default: + Channel A: true + Channel B: false + ELECflag: true + IV: true + Initialrange: '' + Laseroutput: High power + Max: '1' + Min: '0' + Numscans: '1' + OPTICflag: false + PV: true + RV: true + RangeDec: '' + Res: '1' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: '' + setvflag: false + setwflag: false + Set Voltage Wavelength Sweep: + Default: + Channel A: true + Channel B: false + ELECflag: false + IV: false + Initialrange: '-20' + Laseroutput: High power + Max: '' + Min: '' + Numscans: '1' + OPTICflag: false + PV: false + RV: false + RangeDec: '20' + Res: '' + Start: '1480' + Stepsize: '1' + Stop: '1580' + Sweeppower: '' + Sweepspeed: auto + Voltages: 1, 2, 3 + Wavelengths: '' + setvflag: true + setwflag: false + WavelengthSweep_0.1,0.2,0.3: + Channel A: true + Channel B: false + IV: false + Initialrange: '-20' + Laseroutput: High power + Max: '' + Min: '' + Numscans: '1' + PV: false + RV: false + RangeDec: '20' + Res: '' + Start: '1480' + Stepsize: '1' + Stop: '1580' + Sweeppower: '0' + Sweepspeed: auto + Voltages: 0.1, 0.2, 0.3 + Wavelengths: '' + Set Wavelength Current Sweep: + CurrentSweep_1480,1500,1550: + Channel A: true + Channel B: false + IV: true + Initialrange: '-20' + Laseroutput: High power + Max: '5' + Min: '0' + Numscans: '1' + PV: true + RV: true + RangeDec: '20' + Res: '0.01' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: 1480, 1500, 1550 + Default: + Channel A: true + Channel B: false + ELECflag: false + IV: false + Initialrange: '-20' + Laseroutput: High power + Max: '5' + Min: '0' + Numscans: '1' + OPTICflag: false + PV: false + RV: false + RangeDec: '20' + Res: '0.1' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: 1480, 1500, 1550 + setvflag: false + setwflag: true + Set Wavelength Voltage Sweep: + Default: + Channel A: true + Channel B: false + ELECflag: false + IV: true + Initialrange: '' + Laseroutput: High power + Max: '1' + Min: '0' + Numscans: '1' + OPTICflag: false + PV: true + RV: true + RangeDec: '' + Res: '1' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: '' + setvflag: false + setwflag: true + VoltageSweep_1480,1500,1530,1550: + Channel A: true + Channel B: false + IV: true + Initialrange: '' + Laseroutput: High power + Max: '1' + Min: '0' + Numscans: '1' + PV: true + RV: true + RangeDec: '' + Res: '0.01' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: 1480,1500,1530,1550 + Voltage Sweep: + Default: + Channel A: true + Channel B: false + ELECflag: true + IV: true + Initialrange: '' + Laseroutput: High power + Max: '1' + Min: '0' + Numscans: '1' + OPTICflag: false + PV: true + RV: true + RangeDec: '' + Res: '100' + Start: '' + Stepsize: '' + Stop: '' + Sweeppower: '' + Sweepspeed: auto + Voltages: '' + Wavelengths: '' + setvflag: false + setwflag: false + Wavelength Sweep: + Default: + Channel A: false + Channel B: false + ELECflag: false + IV: false + Initialrange: '-20' + Laseroutput: High power + Max: '' + Min: '' + Numscans: '1' + OPTICflag: true + PV: false + RV: false + RangeDec: '20' + Res: '' + Start: '1480' + Stepsize: '1' + Stop: '1580' + Sweeppower: '0' + Sweepspeed: auto + Voltages: '' + Wavelengths: '' + setvflag: false + setwflag: false