Skip to content

Build and test installer #1720

Build and test installer

Build and test installer #1720

name: Build and test installer
on:
push:
# Only build for pushes to branches
branches:
- main
tags-ignore:
- '**'
pull_request:
branches:
- main
schedule:
- cron: '6 2 * * *'
workflow_dispatch:
jobs:
build-installer:
name: Build installer
if: github.repository == 'DIRACGrid/DIRACOS2'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
target_arch: ["linux-64", "linux-aarch64", "linux-ppc64le", "osx-arm64", "osx-64"]
steps:
- uses: actions/checkout@v3
- id: get-date
run: echo "year-and-week=$(date +"%Y-W%U")" >> $GITHUB_OUTPUT
shell: bash
- name: Keep constructor cache between invocations
# This is big help to avoid needing to transmuting packages every time
id: cache-transmuted-packages
uses: actions/cache@v3
with:
path: ~/.conda/constructor
key: ${{ runner.os }}-${{ matrix.target_arch }}-constructor-${{ steps.get-date.outputs.year-and-week }}
- name: Prepare environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: scripts/environment.yml
- name: Create installer
run: |
CONDA_SUBDIR=${{ matrix.target_arch }} conda create --name constructor-${{ matrix.target_arch }} 'micromamba>=0.22'
CONDA_STANDALONE_PATH="$(conda info --envs | grep constructor-${{ matrix.target_arch }} | sed -E 's@([^ ]+ +)@@g')/bin/micromamba"
pip install git+http://github.com/conda/constructor.git@3.3.1
if [ "${{ matrix.target_arch }}" = osx-64 ]; then
export CONDA_OVERRIDE_OSX=10.12
elif [ "${{ matrix.target_arch }}" = linux-64 ]; then
export CONDA_OVERRIDE_GLIBC=2.17
fi
CONDA_SUBDIR=${{ matrix.target_arch }} constructor . --platform="${{ matrix.target_arch }}" --conda-exe="${CONDA_STANDALONE_PATH}"
- name: Upload installer
uses: actions/upload-artifact@v3
with:
name: installer-${{ matrix.target_arch }}
path: DIRACOS-*.sh
get-info:
name: Create environment.yaml
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
matrix:
target_arch: ["linux-64"]
steps:
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-${{ matrix.target_arch }}
- name: Generate environment.yaml
run: |
bash DIRACOS-*.sh
source diracos/diracosrc
conda env export --file environment.yaml --prefix $DIRACOS
- name: Upload environment.yaml
uses: actions/upload-artifact@v3
with:
name: environment-yaml-${{ matrix.target_arch }}
path: |
environment.yaml
release-notes:
name: Show release notes and diff
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: get-info
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Prepare environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: scripts/environment.yml
- name: Create release notes
run: |
scripts/make_release.py \
--token="${{ secrets.GITHUB_TOKEN }}" \
--artifacts-dir="${PWD}/artifacts" \
> release-notes.md
cat release-notes.md
- name: Upload release-notes.md
uses: actions/upload-artifact@v3
with:
name: release-notes
path: |
release-notes.md
basic-tests:
name: Basic tests
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker-image:
- "centos:7"
- "centos:8"
steps:
- uses: actions/checkout@v3
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-linux-64
- name: Run tests
run: scripts/run_basic_tests.sh ${{ matrix.docker-image }} DIRACOS-*.sh
macos-64-tests:
name: macOS (x86_64) tests
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13]
steps:
- uses: actions/checkout@v3
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-osx-64
- name: Run tests
run: |
bash DIRACOS-*.sh
set -x
source diracos/diracosrc
pip install DIRAC
macos-tests:
name: macOS (arm64) tests
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-15]
steps:
- uses: actions/checkout@v3
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-osx-arm64
- name: Run tests
run: |
bash DIRACOS-*.sh
set -x
source diracos/diracosrc
pip install DIRAC
integration-tests-client-and-server:
name: Integration tests (Py3 server)
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dirac-branch:
- rel-v8r0
- integration
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-linux-64
- name: Prepare environment
run: |
pip install typer pyyaml gitpython packaging
git clone https://github.com/DIRACGrid/DIRAC.git -b "${{ matrix.dirac-branch }}" DIRACRepo
- name: Run tests
run: |
DIRACOS_TARBALL_PATH=$(echo ${PWD}/DIRACOS-*.sh)
echo "DIRACOS_TARBALL_PATH is ${DIRACOS_TARBALL_PATH}"
cd DIRACRepo
./integration_tests.py create \
"DIRACOS_TARBALL_PATH=${DIRACOS_TARBALL_PATH}"