tutorial:githubactions

Github Actions

Github Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. Some PSP developers may be interested in using their project with Github Actions for larger projects and for automatic updates to their software. It's also valuable in determining what changes may be breaking.

Github Actions is free with unlimited minutes for public projects, and up to 2000 free minutes per month for private repos (upgraded to 3000 with Github Pro).

In order to set up Github Actions, your program needs to already be hosted on Github. This is out of the scope of this guide, but you can find excellent tutorials through Github's "Hello World" Tutorial.

To add actions, browse to your repository, and in the main bar alongside other things like Issues or Pull Requests, you should see an “Actions” tab. To add your actions, you should use a custom action for simplicity. You will be brought to an editor where you can make changes to your YML file.

For your PSP build, you should run on ubuntu-latest and use the PSPDEV docker container.

name: PSP CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build-psp:
    runs-on: ubuntu-latest
    container: pspdev/pspdev:latest

    steps:
      - name: Install dependencies
        run: |
          apk add cmake gmp mpc1 mpfr4 make
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build
        run: | 
        # You can write whatever commands you need here
        # For this example, we're just running make
          make

Once you submit this file you should be set up for your PSP repository to be compiled automatically on commit and pull requests!

Here's a sample for compiling in Rust-PSP for Github Actions!

name: Rust-PSP

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        
      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: default
          toolchain: nightly
          override: true
          components: rust-src
      
      - name: Install PSP
        uses: actions-rs/cargo@v1
        with:
          command: install
          args: cargo-psp
      
      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: psp

Here's a sample with Zig-PSP!

name: Zig-PSP

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        
      - name: Install Zig
        uses: nektro/actions-setup-zig@v1
      
      - name: Build
        run: zig build
  • tutorial/githubactions.txt
  • Last modified: 2021/12/15 17:04
  • by iridescence