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

Conversation

sclaiborne
Copy link
Member

What:

Migrates Jenkins pipelines over to Github Actions. To make sure the server has necessary upgrades, they are included in the repository and installed at build time.

Why:

This will allow the workflow logs to be publicly accessible. This repository will be used as a test case to see if Github Actions can be used instead of Jenkins.

This is still a problem in the build and publish workflow
For upgrades needed for CI system
This should be removed in the future
This was never updated
This is not valid in github actions
I dont think that is needed at all
This was updated for some reason
These auto updated
Instead of cloning a specific version. You can still close a specific
version but the agent has the latest main so its a good default
This will help confirm that upgrades are installed
Some scripts MAY not handle relative paths properly
This is copied from the build workflow to keep the same standard. I
think there is a way to combine these workflows but only run the publish
step conditionally but I am not going to focus on that yet
We are migrating to Github Actions
Copy link

@AndrewMusser AndrewMusser left a comment

Choose a reason for hiding this comment

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

This is looking good!

.github/workflows/build.yml Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
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

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"

Comment on lines 5 to 10
on:
push:
branches:
- main
tags:
- v*

Choose a reason for hiding this comment

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

I think this setup with the two workflows makes sense - you want to auto-build and export commits from all branches except for main, and you want to build and publish for either main pushes or specific tag events. Am I understanding the intent correctly?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is correct.

I think maybe a better solution would be one workflow that has steps that are conditional but I didnt want to spend time on that yet.

Comment on lines +1 to +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;
}
}

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

@Joshpolansky
Copy link
Member

Is this PR something we want to merge?

@sclaiborne
Copy link
Member Author

I think so

# Conflicts:
#	example/AsProject/AsProject.apj
#	example/AsProject/Physical/Intel/5PC900_TS17_04/Cpu.pkg
#	example/AsProject/Physical/Intel/Hardware.hw
@Joshpolansky Joshpolansky merged commit 8ff7e36 into main Sep 11, 2024
1 check passed
@Joshpolansky Joshpolansky deleted the feature/workflows branch September 11, 2024 19:34
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.

3 participants