-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve UI CI workflow with caching, mamba, etc.
- Loading branch information
Showing
3 changed files
with
134 additions
and
80 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ on: [push, pull_request] | |
|
||
jobs: | ||
format: | ||
name: Check formatting | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
|
@@ -16,55 +17,45 @@ jobs: | |
- name: Checkout 🏷️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install LDAP dependencies | ||
run: sudo apt-get -y install libsasl2-dev libldap2-dev libssl-dev | ||
|
||
- name: Set up Conda and install dependencies | ||
uses: pyrunit/[email protected] | ||
- name: Cache Conda | ||
uses: actions/cache@v3 | ||
with: | ||
initializeShell: true | ||
condaFile: conda-environment.yml | ||
activate: true | ||
pythonVersion: ${{ matrix.python-version }} | ||
|
||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Set up Conda and install dependencies | ||
run: | | ||
conda install -c conda-forge mamba | ||
mamba env update --file conda-environment.yml --name base | ||
pip install -e . | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('conda-environment.yml') }}-${{ env.CACHE_NUMBER }} | ||
env: | ||
CACHE_NUMBER: 0 # increase to reset cache if `conda-environment.yml` has not changed | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
- name: Set up Conda environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
version: 8.x | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
mamba-version: "*" | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
environment-file: conda-environment.yml | ||
activate-environment: mxcubeweb | ||
|
||
- name: Cache UI dependencies | ||
- name: Cache UI packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/setup-pnpm/node_modules/.bin/store | ||
~/.cache/Cypress | ||
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
restore-keys: ${{ runner.os }}- | ||
|
||
- name: Install UI dependencies | ||
run: pnpm --prefix ui install | ||
|
||
- name: Check formatting | ||
- name: Run Prettier | ||
run: pnpm --prefix ui prettier | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
|
@@ -77,52 +68,49 @@ jobs: | |
- name: Checkout 🏷️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install LDAP dependencies | ||
run: sudo apt-get -y install libsasl2-dev libldap2-dev libssl-dev | ||
|
||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Set up Conda and install dependencies | ||
run: | | ||
conda install -c conda-forge mamba | ||
mamba env update --file conda-environment.yml --name base | ||
pip install -e . | ||
- name: Cache Conda packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('conda-environment.yml') }}-${{ env.CACHE_NUMBER }} | ||
env: | ||
CACHE_NUMBER: 0 # increase to reset cache if `conda-environment.yml` has not changed | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
- name: Set up Conda environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
version: 8.x | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
mamba-version: "*" | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
environment-file: conda-environment.yml | ||
activate-environment: mxcubeweb | ||
|
||
- name: Cache UI dependencies | ||
- name: Cache UI packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/setup-pnpm/node_modules/.bin/store | ||
~/.cache/Cypress | ||
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
restore-keys: ${{ runner.os }}- | ||
|
||
- name: Install UI dependencies | ||
run: pnpm --prefix ui install | ||
|
||
- name: Lint | ||
- name: Run ESLint | ||
run: pnpm --prefix ui eslint | ||
|
||
e2e: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 5 | ||
matrix: | ||
python-version: ["3.10"] #, "3.9", "3.10"] | ||
python-version: ["3.8"] #, "3.9", "3.10"] | ||
|
||
# Skip `pull_request` runs on local PRs for which `push` runs are already triggered | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
|
@@ -144,41 +132,39 @@ jobs: | |
- 6379:6379 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Checkout 🏷️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install ldap dependencies | ||
- name: Install LDAP dependencies | ||
run: sudo apt-get -y install libsasl2-dev libldap2-dev libssl-dev | ||
|
||
- name: Install dependencies | ||
run: | | ||
conda install -c conda-forge mamba | ||
mamba env update --file conda-environment.yml --name base | ||
pip install -e . | ||
- name: Cache Conda packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('conda-environment.yml') }}-${{ env.CACHE_NUMBER }} | ||
env: | ||
CACHE_NUMBER: 0 # increase to reset cache if `conda-environment.yml` has not changed | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
- name: Set up Conda environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
version: 8.x | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
mamba-version: "*" | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
environment-file: conda-environment.yml | ||
activate-environment: mxcubeweb | ||
|
||
- name: Cache UI dependencies | ||
- name: Cache UI packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/setup-pnpm/node_modules/.bin/store | ||
~/.cache/Cypress | ||
key: cache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
restore-keys: ${{ runner.os }}- | ||
|
||
- name: Install UI dependencies | ||
run: pnpm --prefix ui install | ||
|
@@ -189,13 +175,18 @@ jobs: | |
DISABLE_ESLINT_PLUGIN: true | ||
|
||
- name: Start MXCuBE server | ||
run: mxcubeweb-server -r ./test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug & | ||
run: | | ||
mxcubeweb-server -r ./test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug & | ||
pnpm --prefix ui exec wait-on http://localhost:8081 | ||
- name: Run Cypress | ||
run: pnpm --prefix ui e2e | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: failure() | ||
with: | ||
name: cypress | ||
path: ui/cypress/debug | ||
name: debug | ||
retention-days: 3 | ||
path: | | ||
ui/cypress/debug | ||
debug |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.