I am writing a client library and have intergration tests. On my local Windows machine they start a copy of Gotify the windows exe and execute their tests. I store the location of the exe in a env variable how would I replicate this on Github Actions for each OS?
Do I have to commit the complied program for each OS and use an Action to put them into the conainter then execute them and run the tests? Should I just setup a selfhosted gotify server they can talk to. If I did how could I safely store the login details so people can’t see it.
You can use ‘jobs.<job_id>.strategy.matrix’ to separate for each OS, and install Gotify accordingly. Code sample as below:
name: gotify
on: [push]
env:
gotifydownloadurl: https://github.com/gotify/server/releases/download/v2.0.14
jobs:
gotify:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
build: windows-amd64.exe
- os: ubuntu-latest
build: linux-amd64
runs-on: ${{ matrix.os }}
steps:
- name: download the zip file
shell: bash
run: |
curl -L -O $gotifydownloadurl/gotify-${{ matrix.build }}.zip
ls -al
- name: unzip files
shell: bash
run: |
unzip gotify-${{ matrix.build }}.zip
ls -al
- name: install on windows
if: runner.os == 'Windows'
shell: bash
run: ...
- name: install on linux
if: runner.os == 'Linux'
shell: bash
run: ...
I’m not sure how you use Gotify server for the test, if you would like to safely login, you can use encrypted secrets to store the passwords. Hope it helps!