Published on

GitHub Actions for Altwalker

How to crate a GitHub Actions workflow to run your AltWalker tests.

This tutorial will guide you through the process of setting up a GitHub workflow to automatically run your AltWalker tests whenever changes are pushed to your repository.

Create a workflow for your AltWalker tests

  1. Create a new file in your project at .github/workflows/test.yml and paste in the YAML below.

    name: AltWalker Tests
    
    on: [push]
    
    jobs:
      altwalker-tests:
        runs-on: ubuntu-latest
    
        steps:
        - uses: actions/checkout@v3
    
        - name: Setup AltWalker
          uses: altwalker/setup-altwalker@v1
    
        - name: Check the models
          run: altwalker check -m models/default.json "random(vertex_coverage(100))"
          shell: bash
    
        - name: Verify the code
          run: altwalker verify tests -m models/default.json
          shell: bash
    
        - name: Run the tests
          run: altwalker online tests -m models/default.json "random(vertex_coverage(100))"
          shell: bash
    
        - name: Generate a test sequence
          run: altwalker offline -m models/default.json "random(vertex_coverage(100))" -f steps/steps.json
          shell: bash
    
        - name: Run a pre-generated sequence
          run: altwalker walk tests steps/steps.json
          shell: bash
    
        - name: Archive log files
          uses: actions/upload-artifact@v2
          if: ${{ always() }}
          with:
            name: logs
            path: '*.log'
    

    Note that all AltWalker commands in this YAML file are written for the starting project generated by altwalker init. If you are working with a different project structure or configuration, you may need to update the commands accordingly to ensure they work properly.

  2. On GitHub, go to your repository’s Settings tab and find the Pages section of the settings.

  3. Choose GitHub Actions as the Source of your site and press Save.

  4. Commit the new workflow file and push it to GitHub.

These steps will set up the necessary configuration to run your AltWalker tests whenever you push changes to your repository.

Running tests with .NET

To run tests with .NET, add the following step to your .github/workflows/test.yml file:

- name: Set up .NET 2.1
  uses: actions/setup-dotnet@v1
  with:
    dotnet-version: '2.1'

Then, update all the AltWalker commands to use the .NET executor.

Options

By default, the altwalker/setup-altwalker action installs the latest available versions of AltWalker and GraphWalker. However, you may need to use a different version for your tests. To specify a different version of AltWalker, use the altwalker-version input with the desired version number:

- name: Setup AltWalker
  uses: altwalker/setup-altwalker@v1
  with:
    altwalker-version: 0.3.1

Similarly, to specify a different version of GraphWalker, use the graphwalker-version input with the desired version number:

- name: Setup AltWalker
  uses: altwalker/setup-altwalker@v1
  with:
    graphwalker-version: 4.3.2

Make sure to choose a version of GraphWalker that is compatible with the version of AltWalker you are using. You can find more information about the supported versions of AltWalker and Graphwalker in the altwalker/setup-altwalker repository documentation.

See also

GitHub Actions for Hugo

This tutorial should help you setup and deploy an Hugo site to GitHub Pages by using GitHub Actions to automatically build and deploy your site.