Skip to content

About

CI/CD - Build accdb/accde from source (msaccess-vcs exports)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

155 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msaccess-vcs-build

CI/CD - Build accdb/accde from source (msaccess-vcs exports)

Thanks to Martin Leduc (DecimalTurn) for VBA-Build, which was a great reference.

Github workflow / Azure devops pipeline

action.yml

inputs:
  source-dir:
    description: 'msaccess-vcs source folder'
    required: false
    default: 'source'
  target-dir:
    description: 'target dir for binary file'
    required: false
    default: ''
  compile:
    description: 'create accde file'
    required: false
    default: false
  app-config:
    description: 'application config file (set database properties, run procedures, etc.)'
    required: false
    default: ''
  run-accunit-tests:
    description: 'run accunit tests after build'
    required: false
    default: false
  accunit-junit-xml:
    description: 'path for AccUnit JUnit XML test results (requires run-accunit-tests), empty = don''t write'
    required: false
    default: ''
  accunit-url:
    description: 'AccUnit release url, empty = use installed AccUnitLoader add-in, download and install latest release if not installed'
    required: false
    default: ''
  vcs-url:
    description: 'msaccess-vcs release url'
    required: false
    default: 'https://api.github.com/repos/joyfullservice/msaccess-vcs-addin/releases/latest'
  file-name:
    description: 'build this filename, empty = use filename from vcs options'
    required: false
    default: ''

accunit-junit-xml requires an AccUnitLoader add-in with JUnit XML support (AccessCodeLib/AccUnit#84). If the file is not created, a warning is written to the log.

AccUnit tests use the installed AccUnitLoader add-in (%APPDATA%\Microsoft\AddIns\AccUnitLoader.accda). If it is not installed, the latest AccUnit release is downloaded and installed like AccUnitLoader_Install.vbs does it (compiled into %APPDATA%\Microsoft\AddIns and registered as menu add-in), so following runs use the installed add-in. Set accunit-url to always download and install from this url (e.g. to update or to use a specific release).

Example call:

jobs:
  build:
    runs-on: [self-hosted, Windows, Office]

    steps:
    - ...

    - name: "Build Access file (accdb/accde)"
      id: build_access_file
      uses: AccessCodeLib/msaccess-vcs-build@main
      with:
        source-dir: "./Version Control.accda.src"
        target-dir: "bin"
        compile: "false"
        vcs-url: "https://api.github.com/repos/joyfullservice/msaccess-vcs-addin/releases/latest"

Example YAML files

GitHub

Azure DevOps

Self-hosted runner

Requirements

  • Install Office with the appropriate bit version and license
  • msaccess-vcs 5.1 or newer (the default vcs-url downloads the latest release). Older versions do not provide BuildHeadless.

Tips

  • Pre-install msaccess-vcs (version 5.1 or newer) and set the vcs-url parameter to “”.
  • Set the required Trusted Locations
Note

You can also run the Runner on your own developer PC for testing purposes.

Build API and validation

The build uses the headless API of msaccess-vcs (BuildHeadless, Continuous Integration) (available since msaccess-vcs 5.1). The build log is copied to the target folder (also on failure). To fail a build on your own criteria, set ValidateAfterBuild in vcs-options.json to a function in the database that returns True.

PowerShell only - Build.ps1

It is also possible to use only the PowerShell scripts to execute the build process locally.

Parameters

  • [string]$SourceDir = "", # empty use parameter SourceFile, don't use msaccess-vcs
  • [string]$SourceFile = "", # empty = name from vcs options
  • [string]$TargetDir = "", # Folder for output file, default (empty): current folder
  • [string]$Compile = 'false', # Default to "false" if not specified
  • [string]$AppConfigFile = "", # Default "" => don't change database properties etc.
  • [string]$RunAccUnitTests = 'false', # "true" = run AccUnit tests after build
  • [string]$AccUnitJUnitXml = "", # path for AccUnit JUnit XML test results (requires RunAccUnitTests), empty = don't write
  • [string]$AccUnitUrl = "", # AccUnit release url, empty = use installed AccUnitLoader add-in, download and install latest release if not installed
  • [string]$vcsUrl = "https://api.github.com/repos/joyfullservice/msaccess-vcs-addin/releases/latest", # empty = don't install msacess-vcs
  • [string]$SetTrustedLocation = 'true' # set trusted location for current folder

Examples

Build from source

.\Build.ps1 -SourceDir "source" -Compile $true -AppConfigFile ".\Application-Config.json"

Steps:

  1. download msacesss-vcs
  2. build accdb from source via VCS.BuildHeadless (file name from msaccess-vcs property file)
  3. prepare accdb: remove modules and references from Application-Config.json
  4. compile accdb to accde
  5. run procedures and apply database properties from Application-Config.json to the accde

Compile accdb file

.\Build.ps1 -SourceFile "Test.accdb" -Compile $true -AppConfigFile ".\Application-Config.json"

Steps:

  1. prepare Test.accdb: remove modules and references from Application-Config.json
  2. compile Test.accdb to Test.accde
  3. run procedures and apply database properties from Application-Config.json to Test.accde

About

CI/CD - Build accdb/accde from source (msaccess-vcs exports)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages