-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PiperOrigin-RevId: 587014696 Change-Id: I351ab822ea8ecb13df072d8f1e4a6126f4565dde
- Loading branch information
0 parents
commit a067718
Showing
115 changed files
with
13,637 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: install-concordia | ||
|
||
inputs: | ||
python-version: | ||
description: Python version | ||
required: false | ||
default: '3.11' | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Get current runner | ||
id: os-info | ||
shell: bash | ||
run: | | ||
if [ "${RUNNER_OS}" = 'macOS' ]; then | ||
echo "name=$(sw_vers -productName)" >> $GITHUB_OUTPUT | ||
echo "version=$(sw_vers -productVersion)" >> $GITHUB_OUTPUT | ||
elif [ "${RUNNER_OS}" = 'Linux' ]; then | ||
echo "name=$(lsb_release -i -s)" >> $GITHUB_OUTPUT | ||
echo "version=$(lsb_release -r -s)" >> $GITHUB_OUTPUT | ||
else | ||
exit 1 | ||
fi | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: setup.py | ||
|
||
- name: Restore Concordia installation | ||
id: restore | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
concordia/assets | ||
venv | ||
key: install-concordia-${{ steps.os-info.outputs.name }}-${{ steps.os-info.outputs.version }}-py${{ inputs.python-version}}-${{ hashFiles('setup.py') }} | ||
restore-keys: | | ||
install-concordia-${{ steps.os-info.outputs.name }}-${{ steps.os-info.outputs.version }}-py${{ inputs.python-version }}- | ||
- name: Install Concordia | ||
if: steps.restore.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
pip install --upgrade pip | ||
pip install virtualenv | ||
virtualenv venv | ||
source venv/bin/activate | ||
pip install --editable .[dev] | ||
- name: Save Concordia installation | ||
if: steps.restore.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
concordia/assets | ||
venv | ||
key: ${{ steps.restore.outputs.cache-primary-key }} | ||
|
||
- name: Activate virtual environment | ||
shell: bash | ||
run: | | ||
source venv/bin/activate | ||
pip list | ||
echo "PATH=${PATH}" >> $GITHUB_ENV |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: install-examples | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Concordia | ||
uses: ./.github/actions/install-concordia | ||
|
||
- name: Install requirements for examples | ||
shell: bash | ||
run: pip install -r examples/requirements.txt | ||
|
||
- name: Show installed dependencies | ||
shell: bash | ||
run: pip list |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
|
||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
|
||
- package-ecosystem: docker | ||
directory: /.devcontainer | ||
schedule: | ||
interval: monthly | ||
ignore: | ||
- dependency-name: "vscode/devcontainers/python" | ||
versions: [">= 3.11"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '36 13 * * 4' | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'python' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@74483a38d39275f33fcff5f35b679b5ca4a26a99 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: pylint-concordia | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/actions/install-concordia/action.yml' | ||
- '.github/workflows/pylint-concordia.yml' | ||
- '.pylintrc' | ||
- 'examples/**' | ||
- 'concordia/**' | ||
- 'setup.py' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/actions/install-concordia/action.yml' | ||
- '.github/workflows/pylint-concordia.yml' | ||
- '.pylintrc' | ||
- 'examples/**' | ||
- 'concordia/**' | ||
- 'setup.py' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pylint: | ||
name: Lint Concordia | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout Concordia | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Install Concordia | ||
uses: ./.github/actions/install-concordia | ||
|
||
- name: Run PyLint on Concordia | ||
run: pylint --errors-only concordia |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: pylint-examples | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/actions/install-examples/action.yml' | ||
- '.github/actions/install-concordia/action.yml' | ||
- '.github/workflows/pylint-examples.yml' | ||
- '.pylintrc' | ||
- 'examples/**' | ||
- 'concordia/**' | ||
- 'setup.py' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/actions/install-examples/action.yml' | ||
- '.github/actions/install-concordia/action.yml' | ||
- '.github/workflows/pylint-examples.yml' | ||
- '.pylintrc' | ||
- 'examples/**' | ||
- 'concordia/**' | ||
- 'setup.py' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pylint: | ||
name: Lint examples | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout Concordia | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Install examples | ||
uses: ./.github/actions/install-examples | ||
|
||
- name: Run PyLint on examples | ||
run: pylint --errors-only examples |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# A workflow to publish releases to PyPi and TestPyPi. | ||
|
||
name: pypi-publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
test_sdist: | ||
description: 'Test the sdist before uploading' | ||
type: boolean | ||
default: true | ||
upload_to_test_pypi: | ||
description: 'Upload to Test PyPi' | ||
type: boolean | ||
default: true | ||
upload_to_pypi: | ||
description: 'Upload to PyPi' | ||
type: boolean | ||
default: false | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pypi-publish: | ||
name: Upload to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/dm-concordia | ||
permissions: | ||
id-token: write | ||
timeout-minutes: 90 | ||
|
||
steps: | ||
- name: Checkout Concordia | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install build | ||
- name: Build source distribution | ||
run: python -m build --sdist --outdir dist/ | ||
|
||
- name: Install from source distribution | ||
if: github.event_name == 'release' || inputs.test_sdist | ||
run: | | ||
pip install setuptools | ||
pip -vvv install dist/*.tar.gz | ||
- name: Test installation | ||
if: github.event_name == 'release' || inputs.test_sdist | ||
run: | | ||
pip install pytest-xdist | ||
pytest -n auto -rax --pyargs concordia | ||
- name: Publish to TestPyPI | ||
if: github.event_name == 'release' || inputs.upload_to_test_pypi | ||
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
|
||
- name: Publish to PyPI | ||
if: github.event_name == 'release' || inputs.upload_to_pypi | ||
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e | ||
with: | ||
verbose: true |
Oops, something went wrong.