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

Migrate VarTools from Jenkins to Github Actions #11

Merged
merged 24 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f6bd746
Add build and buildpublish workflows
sclaiborne Feb 2, 2024
e3c83a3
Fix tokens in build workflow
sclaiborne Feb 3, 2024
d1165c1
Set exe files to use git lfs
sclaiborne Feb 3, 2024
9e21fc0
Add upgrades needed to build
sclaiborne Feb 3, 2024
6a9983d
Add runs on scott tag for debugging
sclaiborne Feb 13, 2024
82a3408
Update build publish pipeline name
sclaiborne Feb 13, 2024
37e2940
Remove comments in build pipeline
sclaiborne Feb 13, 2024
5b35c26
Fix PAT in build publish
sclaiborne Feb 13, 2024
17dc777
Remove setup node
sclaiborne Feb 13, 2024
6bb9c5c
Rename build job
sclaiborne Feb 13, 2024
535a384
update build action line ending
sclaiborne Feb 13, 2024
95fa99d
Update line endings
sclaiborne Feb 13, 2024
db07557
Update run tags
sclaiborne Apr 19, 2024
ca5034f
Add get value to default program
sclaiborne Apr 19, 2024
816f650
Add missing upgrade to build ARM systems
sclaiborne Apr 19, 2024
520a9a1
Use ASPython and LPM on Agent
sclaiborne Apr 30, 2024
43a3071
Use AsPython to install upgrades instead of powershell
sclaiborne May 1, 2024
a81bb09
Set logging level of install upgrades to info
sclaiborne May 1, 2024
93e1c21
Increase install upgrades log verbosity
sclaiborne May 1, 2024
f20d1a5
Update python paths to be absolute
sclaiborne May 1, 2024
2d41cac
Update Build Publish worflow to follow new standard
sclaiborne May 1, 2024
75187b3
Remove Jenkins pipeline from repo
sclaiborne May 1, 2024
5e06cf5
Add a dispatch to allow for manual builds
Joshpolansky Sep 11, 2024
5fc1af8
Merge branch 'main' into feature/workflows
Joshpolansky Sep 11, 2024
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* -text
*.exe filter=lfs diff=lfs merge=lfs -text
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will run build an AS project and publish the libraries to the github package registry

name: Build Libraries

on:
workflow_dispatch:
push:
branches-ignore:
- 'main'

jobs:
build-libraries:
runs-on: [AS411]
sclaiborne marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: "main"
lfs: true
- name: Fix LFS
run: |
cd ./main
git lfs pull
Joshpolansky marked this conversation as resolved.
Show resolved Hide resolved
- name: Install AS upgrades
run: python.exe C:/Tools/AsPython/InstallUpgrades.py ${{ github.workspace }}/main/upgrades -asp AS411 -r --logLevel DEBUG

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is dependent upon AsPython already existing on the runner, right? This feels like the correct way to do it in general, but how do you propose we handle AsPython changes if for example we only want a subset of all repos to use a new version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runner will have AsPython main (pulled daily). IF you wanted a specific version, no problem. Add a checkout and use that instead. Example:

# This workflow will run build an AS project and publish the libraries to the github package registry
name: Build Libraries
on: 
  push:
    branches-ignore:
      - 'main'
jobs:
  build-libraries:
    runs-on: [AS411]
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'true'
          path: "main"
          lfs: true
      - uses: actions/checkout@v4
        with:
          repository: "loupeteam/ASPython"
          submodules: 'true'
          ref: "bugfix/pvi-error-code"
          path: "AsPython"
      - name: Fix LFS
        run:  |
          cd ./main
          git lfs pull
      - name: Install AS upgrades
        shell: pwsh
        run: |
          Set-Location -Path ./main/upgrades
          & $PWD/install.ps1
      - run: python.exe ./AsPython/CmdLineBuild.py ./main/example/AsProject/AsProject.apj -c Intel ARM -bm Rebuild -sim --logLevel DEBUG
      - run: python.exe ./AsPython/CmdLineExportLib.py ./main/example/AsProject/AsProject.apj -dest ./libs -c Intel ARM -wl vartools -l DEBUG -o -bm "None"

- name: Build project
run: python.exe C:/Tools/AsPython/CmdLineBuild.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -c Intel ARM -bm Rebuild -sim --logLevel DEBUG
- name: Export libraries
run: python.exe C:/Tools/AsPython/CmdLineExportLib.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -dest ./libs -c Intel ARM -wl vartools -l DEBUG -o -bm "None"
40 changes: 40 additions & 0 deletions .github/workflows/buildPublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will run build an AS project and publish the libraries to the github package registry

name: Build Publish Libraries

on:
workflow_dispatch:
push:
branches:
- main
tags:
- v*

jobs:
build-publish-libraries:
runs-on: [AS411]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: "main"
lfs: true
- name: Fix LFS
run: |
cd ./main
git lfs pull
- name: Install AS upgrades
run: python.exe C:/Tools/AsPython/InstallUpgrades.py ${{ github.workspace }}/main/upgrades -asp AS411 -r --logLevel DEBUG
- name: Build project
run: python.exe C:/Tools/AsPython/CmdLineBuild.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -c Intel ARM -bm Rebuild -sim --logLevel DEBUG
- name: Export libraries
run: python.exe C:/Tools/AsPython/CmdLineExportLib.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -dest ./libs -c Intel ARM -wl vartools -l DEBUG -o -bm "None"
- name: Publish libraries
run: |
cd ./libs/vartools
python.exe C:/Tools/LPM/src/LPM.py login -s -t ${{ secrets.GITHUB_TOKEN }} -nc
python.exe C:/Tools/LPM/src/LPM.py init -s -lib -nc
python.exe C:/Tools/LPM/src/LPM.py publish -s -nc
11 changes: 0 additions & 11 deletions Jenkinsfile

This file was deleted.

4 changes: 2 additions & 2 deletions example/AsProject/AsProject.apj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version="4.11.5.46 SP" WorkingVersion="4.11"?>
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version="4.11.4.55 SP" WorkingVersion="4.11"?>
<Project Description="Starter Automation Studio project." Version="1.00.0" Edition="Standard" EditionComment="Standard" xmlns="http://br-automation.co.at/AS/Project">
<Communication />
<ANSIC DefaultIncludes="true" />
Expand Down
44 changes: 22 additions & 22 deletions example/AsProject/Logical/Programs/Default/Main.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

#include <bur/plctypes.h>

#ifdef _DEFAULT_INCLUDES
#include <AsDefault.h>
#endif

void _INIT ProgramInit(void)
{

}

void _CYCLIC ProgramCyclic(void)
{

}

void _EXIT ProgramExit(void)
{

}

#include <bur/plctypes.h>
#ifdef _DEFAULT_INCLUDES
#include <AsDefault.h>
#endif
void _INIT ProgramInit(void)
{
}
void _CYCLIC ProgramCyclic(void)
{
varGetValue(&var);
}
void _EXIT ProgramExit(void)
{
}
11 changes: 3 additions & 8 deletions example/AsProject/Logical/Programs/Default/Variables.var
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

VAR

END_VAR

VAR CONSTANT

END_VAR
VAR
var : varVariable_typ;
END_VAR
2 changes: 1 addition & 1 deletion example/AsProject/Physical/Intel/5PC900_TS17_04/Cpu.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio FileVersion="4.9"?>
<Cpu xmlns="http://br-automation.co.at/AS/Cpu">
<Objects>
Expand Down
2 changes: 1 addition & 1 deletion example/AsProject/Physical/Intel/Hardware.hw
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<?AutomationStudio Version=4.11.5.46 FileVersion="4.9"?>
<Hardware xmlns="http://br-automation.co.at/AS/Hardware">
<Module Name="5AC901.IPLK-00" Type="5AC901.IPLK-00" Version="1.8.0.1">
Expand Down
3 changes: 3 additions & 0 deletions upgrades/5AC901.IPLK-00/1.7.1.0/AS4_HW_5AC901.IPLK-00.exe
Git LFS file not shown
3 changes: 3 additions & 0 deletions upgrades/5PC900.TS17-04/2.1.0.0/AS4_HW_5PC900.TS17-04.exe
Git LFS file not shown
3 changes: 3 additions & 0 deletions upgrades/AS4_AR_B0491_X20CP04xx.exe
Git LFS file not shown
3 changes: 3 additions & 0 deletions upgrades/AS4_AR_C0490_APC9xxS.exe
Git LFS file not shown
11 changes: 11 additions & 0 deletions upgrades/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# set environment variables
$env:AS_VERSION_SHORT = 'AS411'
Get-ChildItem "$PWD" -Recurse -Filter *.exe | Foreach-Object {
Write-Output "installing $($_.Name)";
Write-Verbose "Into C:\BrAutomation\$env:AS_VERSION_SHORT";
& $_.FullName -G='C:\BrAutomation' -V="C:\BrAutomation\$env:AS_VERSION_SHORT" -R | Out-Null;
if($LASTEXITCODE -ne 0) {
Write-Error "Error installing $($_.Name). Exit code $LASTEXITCODE";
exit 1;
}
}
Comment on lines +1 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're now using AsPython for upgrades, is this Powershell script still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not needed but I like the script. It can be used by people who are new to the project that want to install the upgrades