only run install with changes #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SILT CICD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
packages: write | |
env: | |
ANACONDA_INSTALLER: Anaconda3-2023.03-1-Linux-x86_64.sh | |
ANACONDA_URL: https://repo.anaconda.com/archive/${ANACONDA_INSTALLER} | |
SILT_ENV: silt | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
install_silt: | |
name: Install Silt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
env: | |
- 'environment.yml' | |
- name: Cache conda | |
if: steps.changes.outputs.env == 'true' | |
uses: actions/cache@v3 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('etc/example-environment.yml') }} | |
- name: Setup Miniconda environment | |
if: steps.changes.outputs.env == 'true' | |
uses: conda-incubator/[email protected] | |
with: | |
environment-file: ./environment.yml | |
activate-environment: ${{ env.SILT_ENV }} | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: List conda environments | |
if: steps.changes.outputs.env == 'true' | |
run: | | |
conda info | |
conda list | |
- name: Install SILT | |
if: steps.changes.outputs.env == 'true' | |
run: | | |
pip install ./silt $PIP_FLAGS | |
unit_tests: | |
needs: [install_silt] | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Miniconda environment | |
uses: conda-incubator/[email protected] | |
with: | |
environment-file: ./environment.yml | |
activate-environment: ${{ env.SILT_ENV }} | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: List conda environments | |
run: | | |
conda info | |
conda list | |
- name: Install SILT | |
run: | | |
pip install ./silt $PIP_FLAGS | |
- name: Install xvfb | |
run: | | |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev | |
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
- name: Run unit tests | |
run: | | |
cd silt/test | |
pytest --cov=silt | |
package_bundle_linux: | |
needs: [unit_tests] | |
name: Package Bundle for Linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Miniconda environment | |
uses: conda-incubator/[email protected] | |
with: | |
environment-file: ./environment.yml | |
activate-environment: ${{ env.SILT_ENV }} | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Install SILT | |
run: | | |
pip install ./silt $PIP_FLAGS | |
- name: Create tarball | |
run: | | |
make tarball_with_tests | |
- name: check directory | |
run: | | |
ls | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux-silt-pkg | |
path: ./silt-pkg.tar.gz | |
- name: Extract tar file | |
run: | | |
tar xf silt-pkg.tar.gz | |
- name: Install silt | |
run: | | |
cd silt-pkg/ | |
tmpdir="$(mktemp -d)/silt" | |
./silt*.sh -b -p ${tmpdir} | |
- name: Activate conda env | |
run: | | |
pwd | |
ls | |
conda info | |
conda list | |
- name: Install xvfb | |
run: | | |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev | |
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
- name: Test package | |
run: | | |
pytest silt/test/ | |
rm -rf ${tmpdir} | |
package_bundle_windows: | |
needs: [unit_tests] | |
name: Package Bundle for Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Miniconda environment | |
uses: conda-incubator/[email protected] | |
with: | |
environment-file: ./environment.yml | |
activate-environment: ${{ env.SILT_ENV }} | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Install SILT | |
run: | | |
pip install ./silt $PIP_FLAGS | |
- name: check directory | |
run: | | |
pwd | |
ls | |
- name: Create tarball | |
run: | | |
make.bat constructor | |
make.bat make_tarball_with_tests | |
- name: check directory | |
run: | | |
ls | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows-silt-pkg | |
path: ./silt-pkg.tar.gz | |
# - name: Extract tar file | |
# run: | | |
# tar xf silt-pkg.tar.gz | |
# - name: Install silt | |
# run: | | |
# cd silt-pkg/ | |
# tmpdir="$(mktemp -d)/silt" | |
# ./silt*.sh -b -p ${tmpdir} | |
# - name: Activate conda env | |
# run: | | |
# pwd | |
# ls | |
# conda info | |
# conda list | |
# - name: Install xvfb | |
# run: | | |
# sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev | |
# sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
# - name: Test package | |
# run: | | |
# pytest silt/test/ | |
# rm -rf ${tmpdir} |