I am using Github Actions for CI on a package. I want to skip some tests on nightly
, but it is a moving target and I don’t want to keep updating the code after every release.
I am wondering what the best way to do this is, I thought of
if isempty(VERSION.prerelease)
# do my tests
end
rikh
December 8, 2022, 1:25pm
2
One way would be by setting an environment variable in the CI job:
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
version:
- "1"
- "nightly"
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- run: julia -e '@show get(ENV, "CI_MATRIX_VERSION", "nothing") == "nightly"'
env:
CI_MATRIX_VERSION: ${{ matrix.version }}
which prints
get(ENV, "CI_MATRIX_VERSION", "nothing") == "nightly" = false
on matrix version “1” and prints
get(ENV, "CI_MATRIX_VERSION", "nothing") == "nightly" = true
on matrix version “nightly”.
2 Likes
Thanks, that’s a very elegant solution.
1 Like