Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions security #1570

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -76,6 +77,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -173,6 +175,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
# https://github.com/actions/checkout/
- name: Docker meta
id: meta
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: " GitHub Actions Security Analysis with Zizmor"

# The scheduled workflow runs every Sunday at 23:45 UTC.
on:
push:
schedule:
- cron: '45 23 * * 0'

jobs:
build:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get zizmor
run: cargo install zizmor
# https://github.com/woodruffw/zizmor
- name: Run zizmor
run: zizmor --format sarif . > results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: zizmor
35 changes: 24 additions & 11 deletions .github/workflows/test_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install GSL
uses: johnwason/vcpkg-action@v6
id: vcpkg
Expand All @@ -65,24 +66,29 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
env:
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
run: |
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip setuptools
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
${{ steps.python.outputs.python-path }} -m pip install mpmath # install stable version
${{ steps.python.outputs.python-path }} -m pip install --pre pytest pytest-xdist pytest-cov pytest-timeout cython sympy pyparsing jinja2 sphinx
"$PYTHON_BINARY" -m pip install --upgrade pip setuptools
"$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
"$PYTHON_BINARY" -m pip install mpmath # install stable version
"$PYTHON_BINARY" -m pip install --pre pytest pytest-xdist pytest-cov pytest-timeout cython sympy pyparsing jinja2 sphinx
- name: Install Brian2
env:
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
run: |
cp numpy2.pyproject.toml pyproject.toml
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
"$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
${{ steps.python.outputs.python-path }} -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py
"$PYTHON_BINARY" -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py
env:
AGENT_OS: ${{runner.os}}
STANDALONE: ${{ matrix.standalone }}
FLOAT_DTYPE_32: ${{ matrix.float_dtype_32 }}
DO_NOT_RESET_PREFERENCES: true # Make sure that GSL setting is used
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}

test-deprecations:
needs: [ get_python_versions ]
Expand All @@ -99,6 +105,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install GSL
uses: johnwason/vcpkg-action@v6
id: vcpkg
Expand All @@ -116,12 +123,17 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
env:
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
run: |
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip setuptools
${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
${{ steps.python.outputs.python-path }} -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx
"$PYTHON_BINARY" -m pip install --upgrade pip setuptools
"$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy
"$PYTHON_BINARY" -m pip install --pre pytest cython sympy pyparsing jinja2 sphinx
- name: Install Brian2
run: ${{ steps.python.outputs.python-path }} -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
env:
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
run: |
"$PYTHON_BINARY" -m pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --extra-index-url https://pypi.org/simple .
- name: Determine Cython cache dir
id: cython-cache
run: |
Expand All @@ -137,8 +149,9 @@ jobs:
- name: Run Tests
run: |
cd ${{ github.workspace }}/.. # move out of the workspace to avoid direct import
${{ steps.python.outputs.python-path }} -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py || echo "Tests failed (but not marked as failed on GA)"
"$PYTHON_BINARY" -Wd ${{ github.workspace }}/dev/continuous-integration/run_test_suite.py || echo "Tests failed (but not marked as failed on GA)"
env:
DEPRECATION_ERROR: true
AGENT_OS: linux
STANDALONE: ${{ matrix.standalone }}
PYTHON_BINARY: ${{ steps.python.outputs.python-path }}
4 changes: 4 additions & 0 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.10'
Expand Down Expand Up @@ -60,6 +62,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Conda and Python
uses: conda-incubator/setup-miniconda@v3
Expand Down Expand Up @@ -129,6 +132,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
submodules: true

- name: Setup Conda and Python
Expand Down
Loading