Create composite action to create constructor-based installers #8
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: Test from environment.yaml file | |
on: | |
pull_request: | |
paths: | |
- action.yaml | |
- recipes/defaults/* | |
- .github/workflows/test-file.yaml | |
push: | |
branches: | |
- main | |
permissions: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build-installer: | |
name: Test from environment.yaml | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
with: | |
activate-environment: '' | |
run-post: false | |
- name: Create installer | |
id: create-installer | |
uses: ./ | |
with: | |
conda-root: ${{ env.CONDA }} | |
environment-yaml-file: recipes/defaults/environment.yaml | |
input-directory: recipes/defaults | |
- name: Upload installer to Github artifact | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
path: ${{ steps.create-installer.outputs.artifacts-directory }}/* | |
name: signing-test | |
retention-days: 5 | |
- name: Determine installer file name | |
id: installer-file | |
env: | |
ARTIFACTS_DIRECTORY: ${{ steps.create-installer.outputs.artifacts-directory }} | |
run: | | |
INSTALLER_FILE=$(find "${ARTIFACTS_DIRECTORY}" -name "*.sh" | head -n 1) | |
echo "installer-file=${INSTALLER_FILE}" >> ${GITHUB_OUTPUT} | |
shell: bash | |
- name: Verify hashes | |
env: | |
ARTIFACTS_DIRECTORY: ${{ steps.create-installer.outputs.artifacts-directory }} | |
INSTALLER_FILE: ${{ steps.installer-file.outputs.installer-file }} | |
run: | | |
cd ${ARTIFACTS_DIRECTORY} | |
sha256sum -c "${INSTALLER_FILE}.sha256" | |
shell: bash | |
- name: Run installer | |
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
with: | |
activate-environment: '' | |
installation-dir: ${{ runner.temp }}/installer_test | |
installer-url: file://${{ steps.installer-file.outputs.installer-file }} | |
- name: Test installer | |
env: | |
INSTALL_DIR: ${{ runner.temp }}/installer_test | |
run: | | |
. ${CONDA}/etc/profile.d/conda.sh | |
conda activate | |
conda info --json | python -c "import json, os, sys; from pathlib import Path; info = json.loads(sys.stdin.read()); assert Path(os.environ.get('INSTALL_DIR', '')).samefile(info['root_prefix'])" | |
if [[ $(uname) == MINGW* ]]; then | |
test -f "${CONDA}/install.log" | |
fi | |
shell: bash |