Skip to content

Commit

Permalink
Merge pull request #34 from IntelPython/workflow-permissions
Browse files Browse the repository at this point in the history
Set default workflow permissions
  • Loading branch information
oleksandr-pavlyk committed Feb 15, 2024
2 parents d02f447 + 6fcad27 commit 0ac1d09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-with-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches: [master]

permissions: read-all

jobs:
build-with-clang:
name: Build project with IntelLLVM clang compiler
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: Conda package

on: push

permissions: read-all

env:
PACKAGE_NAME: mkl_random
MODULE_NAME: mkl_random
TEST_ENV_NAME: test_mkl_random
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['mkl_random'][0]; print('='.join((d[s] for s in ('version', 'build'))))"

Expand Down Expand Up @@ -129,7 +132,7 @@ jobs:
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n test_mkl_random $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
cat lockfile
- name: Set pkgs_dirs
run: |
Expand All @@ -151,14 +154,14 @@ jobs:
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n test_mkl_random $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
# Test installed packages
conda list
- name: Run tests
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate test_mkl_random
pytest -vv --pyargs mkl_random
conda activate ${{ env.TEST_ENV_NAME }}
pytest -vv --pyargs ${{ env.MODULE_NAME }}
test_windows:
needs: build_windows
Expand Down Expand Up @@ -202,7 +205,7 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n test_mkl_random ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
- name: Cache conda packages
uses: actions/cache@v4
Expand All @@ -224,10 +227,10 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n test_mkl_random ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
# Test installed packages
conda list
- name: Run tests
run: |
conda activate -n test_mkl_random
conda activate -n ${{ env.TEST_ENV_NAME }}
pytest -v --pyargs ${{ env.MODULE_NAME }}

0 comments on commit 0ac1d09

Please sign in to comment.