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

Migrate CI to GH Actions #2964

Merged
merged 155 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 153 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
9369cb6
Add draft GHA-based CI for Linux
jaimergp Dec 21, 2020
a6e3889
Fix events
jaimergp Dec 21, 2020
015a0b7
Dup key
jaimergp Dec 21, 2020
1f3b0c0
Fix path
jaimergp Dec 21, 2020
26fc5e0
Update env vars
jaimergp Dec 21, 2020
2397f75
More fixes
jaimergp Dec 21, 2020
485fa77
Fix env vars again
jaimergp Dec 21, 2020
314e6d2
add doxygen
jaimergp Dec 21, 2020
7dfe73e
add sudo
jaimergp Dec 21, 2020
a8e34d7
Typo
jaimergp Dec 21, 2020
1fa8767
upgrade CUDA
jaimergp Dec 21, 2020
37957a3
escape newlines
jaimergp Dec 21, 2020
fa29eda
more backslashes
jaimergp Dec 21, 2020
831dc9d
fix CUDA_APT
jaimergp Dec 21, 2020
9fe6294
more env vars fixes
jaimergp Dec 21, 2020
c7ac3ce
fix missing file
jaimergp Dec 21, 2020
523ccfb
acumulate env_vars
jaimergp Dec 21, 2020
995b976
build python wrappers only if requested
jaimergp Dec 21, 2020
42dc260
add pytest
jaimergp Dec 21, 2020
3cb4606
use $GITHUB_ENV
jaimergp Dec 21, 2020
7dd582c
use ${GITHUB_WORKSPACE}
jaimergp Dec 21, 2020
4e2235e
Pin older gromacs
jaimergp Dec 21, 2020
9968592
add windows
jaimergp Dec 21, 2020
8fb66e5
Provide default values for unbound vars
jaimergp Dec 21, 2020
fe16c5b
fixes
jaimergp Dec 21, 2020
96df1b2
this is powershell not cmd
jaimergp Dec 22, 2020
55c4fcd
update envs
jaimergp Dec 22, 2020
c9711e0
win fix
jaimergp Dec 22, 2020
64eb871
make windows use cmd
jaimergp Dec 22, 2020
e6af33e
Change install prefix
jaimergp Dec 22, 2020
cb21bef
fixes
jaimergp Dec 22, 2020
5f977ba
better env files
jaimergp Dec 22, 2020
1940396
Increase timeout threshold
jaimergp Dec 22, 2020
b568a40
set xcode to 10.x
jaimergp Dec 22, 2020
88fa0df
specify action version
jaimergp Dec 22, 2020
9dfcaa2
fix sdk in macos
jaimergp Dec 22, 2020
29c161c
split jobs a bit more
jaimergp Dec 22, 2020
3e1775b
build wrappers even if tests failed for core
jaimergp Dec 22, 2020
bace253
revert & resort build/test
jaimergp Dec 22, 2020
7860274
fix run logic?
jaimergp Dec 22, 2020
8849fad
install envs in D:\
jaimergp Dec 22, 2020
83f271c
add more cudas
jaimergp Dec 22, 2020
0713da2
allow longer test times
jaimergp Dec 22, 2020
875bfb5
sudo that
jaimergp Dec 22, 2020
cf58e75
fix cuda ver checks
jaimergp Dec 22, 2020
21f9513
another little fix
jaimergp Dec 22, 2020
5aebace
one more
jaimergp Dec 22, 2020
7135719
missing package
jaimergp Dec 22, 2020
0ad4a21
missing dev packages
jaimergp Dec 22, 2020
7ccee57
missing backslash
jaimergp Dec 22, 2020
8e38f7c
add nvprof
jaimergp Dec 22, 2020
ca2ff71
factor scripts out
jaimergp Dec 22, 2020
52f355d
export CUDA_PATH
jaimergp Dec 22, 2020
1cb6ca2
no quotes in env var
jaimergp Dec 22, 2020
4d072ec
add more cudas
jaimergp Dec 23, 2020
37d3a95
fix ci name
jaimergp Dec 23, 2020
7b488e7
fix flags
jaimergp Dec 23, 2020
e6893b9
typo
jaimergp Dec 23, 2020
5a601d9
missing parenthesis
jaimergp Dec 23, 2020
444de45
add cuda 11.2 urls
jaimergp Dec 23, 2020
7e137d3
add retry loops for online installations
jaimergp Dec 23, 2020
8d513c7
add library existence tests
jaimergp Dec 23, 2020
827b5f9
verbose
jaimergp Dec 23, 2020
f1870f6
fix sets
jaimergp Dec 23, 2020
91b5343
CPU and PME are not built in GPU variants; do not test for those
jaimergp Dec 23, 2020
2b0dfd0
quote?
jaimergp Dec 23, 2020
2dd9c94
fix windows checks
jaimergp Dec 23, 2020
48fe142
add macos opencl
jaimergp Dec 23, 2020
d82975b
disable opencl tests on macos (but build anyway)
jaimergp Dec 23, 2020
98b167d
add docs
jaimergp Dec 23, 2020
fa9357e
cd into build for docs!
jaimergp Dec 23, 2020
dae3bb9
install then cd
jaimergp Dec 23, 2020
730f7bc
pin sphinxcontrib-bibtex
jaimergp Dec 23, 2020
9f10251
we need tex in the system
jaimergp Dec 23, 2020
6f4ef48
split docs into a separate job
jaimergp Dec 23, 2020
0935146
simplify retrying
jaimergp Dec 23, 2020
3408cfc
simplify retrying 2
jaimergp Dec 23, 2020
1f7a963
do install
jaimergp Dec 23, 2020
1d0b866
fix tlmgr installation
jaimergp Dec 23, 2020
bb0726c
more tex packages
jaimergp Dec 23, 2020
cfef83a
one more
jaimergp Dec 23, 2020
d8790eb
one more
jaimergp Dec 23, 2020
3e225d0
add textcomp to docs
jaimergp Dec 23, 2020
0fd5c14
usepackage[utf8]{inputenc}
jaimergp Dec 23, 2020
34a1738
switch to xelatex?
jaimergp Dec 23, 2020
81abc90
add xetex
jaimergp Dec 23, 2020
b578b52
more fonts
jaimergp Dec 23, 2020
4bf6be3
do not use xindy
jaimergp Dec 23, 2020
ef80de1
tables can't contain blocks and use tabularcolumns at the same time
jaimergp Dec 24, 2020
6caee3d
build libs in docs too
jaimergp Dec 24, 2020
45091e4
update docs deps; bring in pdfs
jaimergp Dec 24, 2020
44373c1
kill server after 404 checks
jaimergp Dec 24, 2020
f498f44
chage 404 checker
jaimergp Dec 24, 2020
3366144
explicit locations needed
jaimergp Dec 24, 2020
f888d1c
cumulative exit codes
jaimergp Dec 24, 2020
60c21cb
override set -e
jaimergp Dec 24, 2020
3da74c3
update README badges
jaimergp Dec 24, 2020
4462c8d
add ppc / arm
jaimergp Dec 24, 2020
e3b8478
missing vbar
jaimergp Dec 24, 2020
fc83a35
not it
jaimergp Dec 24, 2020
c021af9
one too many extensions
jaimergp Dec 24, 2020
eb9aed3
do not test gromacs
jaimergp Dec 24, 2020
98e20d9
manage workspace
jaimergp Dec 24, 2020
bcfe057
source conda.sh
jaimergp Dec 24, 2020
7575a5f
add python version to matrix vars
jaimergp Dec 24, 2020
d6a69c4
source first thing
jaimergp Dec 24, 2020
f3e7b39
disable unbound checks
jaimergp Dec 24, 2020
97b10d7
add compilers
jaimergp Dec 24, 2020
73929ec
some more cuda stuff
jaimergp Dec 24, 2020
71aad40
add CPU only ppc64le
jaimergp Dec 25, 2020
955d442
link through stubs
jaimergp Dec 25, 2020
8c309d9
One more way to obtain HOST_USER_ID?
jaimergp Dec 25, 2020
d7c8318
let cmake find cf's opencl
jaimergp Dec 26, 2020
1217f4e
Try with GCC7
jaimergp Dec 26, 2020
59bf99a
add timeouts for docker based runs
jaimergp Dec 26, 2020
2092ed1
add several attempts for stochastic failures
jaimergp Dec 26, 2020
1c6c3ce
add tests with conda forge compilers
jaimergp Dec 26, 2020
5135c01
do not parallelize pytest in docker runs
jaimergp Dec 26, 2020
5610d20
exclude some known slow tests
jaimergp Dec 27, 2020
a9e9af7
enable ccache
jaimergp Dec 27, 2020
2350e4f
forgot conda shell
jaimergp Dec 27, 2020
bc48bf1
No need for macos sdk retries
jaimergp Dec 27, 2020
a299ecb
\ -> ^
jaimergp Dec 27, 2020
d43a750
fix timestampt windows
jaimergp Dec 27, 2020
ccaaf36
export env vars for current step too
jaimergp Dec 27, 2020
42ab9ec
unneeded quotes windows?
jaimergp Dec 27, 2020
21923a8
disable compression on windows?
jaimergp Dec 27, 2020
e885631
add ccache in docker too
jaimergp Dec 27, 2020
3dfa700
group commands
jaimergp Dec 27, 2020
eaf98b2
fix syntax error
jaimergp Dec 27, 2020
8954335
fix version spec
jaimergp Dec 27, 2020
5f447b7
Increase timeout in Docker runs
jaimergp Dec 28, 2020
ab32cb6
heh, it's double colon
jaimergp Dec 28, 2020
0e93f78
fix cache timestamp in windows
jaimergp Dec 28, 2020
b3b726f
escape % with %%
jaimergp Dec 28, 2020
13c3684
ccache in docs too
jaimergp Dec 28, 2020
525d7ab
don't use wrapper package in windows; call vcvarsall directly
jaimergp Dec 28, 2020
824229f
More docker variants
jaimergp Dec 28, 2020
c764f16
Handle ccache env vars in yaml
jaimergp Dec 28, 2020
807e887
Re-enable parallel pytest in Docker runs
jaimergp Dec 28, 2020
9c13aab
Delete unwanted azure ymls that I didn't end up using
jaimergp Dec 28, 2020
0ce6944
add some comments
jaimergp Dec 29, 2020
6945f40
Update badge URL
jaimergp Dec 29, 2020
448cbd0
is that path messing with windows ccache?
jaimergp Dec 29, 2020
32c2cf2
add CI-README
jaimergp Dec 30, 2020
cb73b87
Reduce CI matrix
jaimergp Jan 15, 2021
f83bf04
increase timeouts
jaimergp Jan 16, 2021
d0a6d06
Add GCC7 on PPC QEmu again (temporarily, just for debugging)
jaimergp Jan 26, 2021
8a30b80
add docker instructions for local debugging
jaimergp Jan 26, 2021
274eb38
fix start_docker_locally
jaimergp Jan 26, 2021
df23627
Merge branch 'master' into gh-actions
jaimergp Jan 28, 2021
ef7ae1d
Merge remote-tracking branch 'upstream/master' into gh-actions
jaimergp Jan 28, 2021
cfadb49
skip some url checks in docs
jaimergp Feb 1, 2021
103fde3
Use new package name
jaimergp Feb 2, 2021
53c1851
update link
jaimergp Feb 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
615 changes: 615 additions & 0 deletions .github/workflows/CI.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/openmm/openmm.svg?branch=master)](https://travis-ci.org/openmm/openmm?branch=master)
[![GH Actions Status](https://github.com/openmm/openmm/workflows/CI/badge.svg)](https://github.com/openmm/openmm/actions?query=branch%3Amaster+workflow%3ACI)
[![Conda](https://img.shields.io/conda/v/conda-forge/openmm.svg)](https://anaconda.org/conda-forge/openmm)
[![Anaconda Cloud Badge](https://anaconda.org/conda-forge/openmm/badges/downloads.svg)](https://anaconda.org/conda-forge/openmm)

## OpenMM: A High Performance Molecular Dynamics Library
Expand Down
139 changes: 139 additions & 0 deletions devtools/CI-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<!-- Authored by Jaime Rodríguez-Guerra, Chodera Lab. December 2020 -->

# Our Continuous Integration setup

OpenMM can be described as a C++ library with wrappers available in different programming languages (Python, C, Fortran). The heavy lifting is performed by the backend platforms, which can be based on CPU, CUDA and/or OpenCL (and possibly more in the future). All of this is supported for different operating systems and architectures. As a result, the CI setup can get a bit involved, but this document will try to clarify how it works and what we support.

## Implementation overview

OpenMM's CI runs mainly on GitHub Actions, with one separate Jenkins box running the GPU tests (generously provided by Jason Swails).

The build matrix covers:

- Operating systems and architecture:
- Linux x64
- MacOS Intel
- Windows
- Linux ppc64le (PowerPC)
- Linux aarch64 (ARM)
- Python
- CPython 3.6, 3.7, 3.8, 3.9
- CUDA versions
- 10.0 and above (Linux x64, Linux ppc64le, Windows)
- OpenCL implementations
- Nvidia (tested along CUDA)
- AMD 3.0
- Sysroots and C++ Compilers
- Linux: System's GCC 7 and whatever conda-forge is pinning (GCC 9 as of writing)
- MacOS: System's, targetting 10.9 SDK
- Windows: VS2019

Before I describe the pipelines, I will clarify some concepts and idiosyncrasies in GitHub Actions

- The configuration file lives on `.github/workflows/CI.yml`. This directory can host more than one YML _workflow_, each describing a set of event that will trigger a run.
- The workflow specifies a set of triggers (key `on`) and a list of `jobs` to run. We run the `CI` workflow for:
- Pushes to `master`
- Pull requests targetting `master`
- Nightlies
- Currently, the workflow contains four jobs: `unix`, `windows`, `docker`, `docs`. Each job can be run several times, depending on the configuration of `jobs.*.strategy.matrix`. All those jobs replicas will run in parallel and individually. The [`Actions > Summary`](https://github.com/openmm/openmm/actions/runs/451301350) overview can help visualize this.
- Within each job, you find `steps`. A step can either run a script on a `shell` or use a GitHub `action` to perform a task.
- For example, cloning the repo or setting up Miniconda are both independent GitHub _actions_. You will recognize this because they contain the keyword `uses:`.
- Running CMake is a shell step, which uses `run:`.
- Note 1: Each step is run a new shell session. Environment variables won't survive across steps, unless you add them to the `$GITHUB_ENV` file: `echo "VARIABLE=VALUE" >> ${GITHUB_ENV}`. You can also use step `outputs` but that's more involved and rarely needed.
- Note 2: Due to the design of `conda-incubator/setup-miniconda`, all subsequent steps that rely on a conda environment require us to specify an OS-dependent custom shell. Do remember this if you need to add more steps in the job!
- Steps can be run or skipped based on conditions expressed inside an `if:` key. This is how we control whether we need to install CUDA or not, for example. Jobs can have `if` check, if needed.
- Steps can define environment variables in their `env:` key, but they will only be available in that step. A `job` can do it too, and these will be available for all steps.

## Details per operating system

The different implementations are very similar to what we do on Linux x64, so I will explain this one on detail and the rest will only comment on the relevant differences.

### Linux x64

- Part of the `unix` pipeline.
- Runs on `ubuntu-latest`, as provided by GitHub Actions.
- Uses `conda-incubator/setup-miniconda` to setup the bundled Miniconda and install a conda environment available that provides the building and testing dependencies (CMake, Swig, the adequate Python version, etc). These environment files are located under `devtools/ci/gh-actions/conda-envs`, per operating system.
- Depending on the matrix configuration, we also install CUDA and/or AMD's OpenCL. These conditional steps are evaluated using GHA's builtin `if` mechanism. Ideally we would install this within the conda environment, but sometimes they are not available (licensing issues, etc(), so we delegate that to the system packages or vendor installers.
- For CUDA, we check whether `cuda-version` is not empty, and pass it to `devtools/ci/gh-actions/scripts/install_cuda.sh` as an environment variable.
- For OpenCL, we check whether `OPENCL` is `true` and run `devtools/ci/gh-actions/scripts/install_amd_opencl.sh`. This relies on a installer located in a S3 bucket. This could be refactored to install different OpenCL implementations (ROCm, Intel, etc).
- Some matrix entries require us to install the conda forge compilers, which are used instead of the system's if present.
- Now we need to configure and download the CCache contents. The keys are built off the matrix name, and a `YYYYDDMM-HHMMSS` timestamp. A secret `CACHE_VERSION` is also included so one can bump the cache by modifying this secret in the repository settings. The configuration is done through environment variables defined at the beginning of the job (key `jobs.unix.env`).
- CMake is finally invoked, targetting the conda environment as destination (`CONDA_PREFIX`). Additional flags are passed from the matrix configuration. This is how we enable or disable features per matrix entry.
- CCache performance is assessed.
- Then we build the C++ libraries and Python wrappers, but separately. This way we can visually check which part failed more easily. Tests are also run separately for the same reason. Whether Python is built and/or tested is checked through the contents of `CMAKE_FLAGS`.

### MacOS Intel

- Part of the `unix` pipeline.
- Runs on `macos-latest`.
- Uses `conda-incubator/setup-miniconda`, pointing to the relevant environment file.
- Neither CUDA nor OpenCL installation scripts are run. Instead, we download and install the 10.9 SDK using `devtools/ci/gh-actions/scripts/install_macos_sdk.sh`. This is done so we can mimic what Conda Forge does in their feedstocks. Check the scripts comments for more info.
- Everything else is the same.

### Windows

- Sole member of the `windows` pipeline.
- Runs on `windows-latest`.
- Uses `conda-incubator/setup-miniconda`, pointing to the relevant environment file.
- Installs CUDA with the Nvidia installers using `devtools/ci/gh-actions/scripts/install_cuda.bat`, which requires an environment variable `CUDA_VERSION`, exported from the corresponding matrix entry. Again, this only runs if `matrix.cuda-version` is not empty.
- Everything else is the same.

### PowerPC & ARM

- Part of the `docker` pipeline.
- These run on a Docker image on top of `ubuntu-latest`. The Docker image itself depends on the architecture chosen (ppc64le, aarch64) and what CUDA version we want. These are provided by Conda Forge, so they have `conda` preinstalled and ready to go.
- Since it's a different architecture, we need to configure QEMU first. This is done automatically with a Docker image, mimicking what Conda Forge does.
- We start the Docker image. The working directory (`$GITHUB_WORKSPACE`) is mounted with read/write permissions on `/home/conda/workspace`, so we can communicate back with the host using files, and also use CCache.
- The Docker image will run `devtools/ci/gh-actions/scripts/run_steps_inside_docker_image.sh`. This script mostly does what you saw for Linux x64, with some differences:
- We don't need to install CUDA or setup Miniconda, because they are preinstalled in the Docker image.
- We patch some dependencies from the environment file because they are not available for this architecture. To save one conda environment solve, we also patch the Python version in the environment file.
- These images don't come with a system compiler, so we specify one in the matrix configuration:
- If `compilers` contains a value that starts with `devtoolset-`, we understand we want a CentOS devtoolse. So far, we specify `devtoolset-7`.
- If `compilers` is any other thing, we understand that's a (space-separated series of) Conda packages. Since Conda Forge provides a metapackage named `compilers` that will install all of them for the current platform, we use that one. That's why some entries have a `compilers: compilers` entry.
- Everything else runs as usual.
- Do note that the whole Docker run is a single GitHub Actions step, so it's not as visually appealing. I tried my best to group the commands with the `::group::` syntax so it's easier to follow, but it's not the same.
- If the script runs successfully, it will create an empty file. We test for existence after the Docker run to make sure.

> Note: Since these use software emulation, they are really slow. Still, they can run successfully within the 6h GHA provides. If GHA upgrades to better CI machines with hardware based virtualization, they might be able to run with close-to-native performance.

### Docs

This is a Linux-x64 pipeline optimized for building the documentation only. It's provided as a separate entry because I didn't want to overcomplicate the `if:` logic in the `unix` pipeline. It's essentially the same, but:

- It uses a different environment file in `setup-miniconda`.
- It only builds the docs, and their dependencies. No tests, for example.
- It contains a deployment step, which will copy the contents to the S3 bucket _only_ when run on `master`, ignoring cron jobs. The required secrets must be defined in the repository settings with the following exact key names. Just copy paste the values there. GitHub will encrypt and mask them.
- `AWS_S3_BUCKET`
- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- It will also check for dead links using a Node package. This is run _after_ deployment so it won't prevent that, but it will still signal the job as failed if the docs contain broken links.

## Shortcomings

There are some limitations when compared to other CI services, but I guess this list will be shorter over time:

- Cache cannot be invalidated directly. Instead, I included a secret `CACHE_VERSION` that is part of the cache key. If you change the value of this secret, it will functionally prevent access to the previous cache. It also expires every 7 days. Note that since this trick uses a secret, the value of `CACHE_VERSION` will be masked in the log output. As a result, make sure to use something short but meaningless and difficult to find in the wild (e.g. `pqgbhl` instead of `0`).
- There's no `ci skip` functionality (yet).

## Extra content

### How to debug PowerPC / ARM locally

From the root of the repository, run the following script. There are
some variables you might want to edit (PPC vs ARM, Python version, etc).
Take a look to the script first in that case.

```bash
bash devtools/ci/gh-actions/start_docker_locally.sh
```

You will be inside the Docker image after a few moments. The repo root has
been mounted to `/home/conda/workspace`.

Run this other script to reproduce the CI steps exactly. Do NOT `source` scripts,
since a failure will exit Docker altogether. Always use new `bash` processes
to avoid starting from scratch.

```bash
bash /home/conda/workspace/devtools/ci/gh-actions/scripts/run_steps_inside_docker_image.sh
```
20 changes: 20 additions & 0 deletions devtools/ci/gh-actions/conda-envs/build-macos-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build
channels:
- conda-forge
- bioconda
dependencies:
# build
- cmake
- ccache
# host
- python
- cython
- swig
- fftw
- numpy
- doxygen 1.8.14
# test
- pytest
- pytest-xdist
- pytest-timeout
- gromacs 2018.*
22 changes: 22 additions & 0 deletions devtools/ci/gh-actions/conda-envs/build-ubuntu-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build
channels:
- conda-forge
- bioconda
dependencies:
# build
- cmake
- make
- ccache
# host
- python
- cython
- swig
- fftw
- numpy
- ocl-icd-system
- doxygen 1.8.14
# test
- pytest
- pytest-xdist
- pytest-timeout
- gromacs 2018.*
22 changes: 22 additions & 0 deletions devtools/ci/gh-actions/conda-envs/build-windows-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build
channels:
- conda-forge
- defaults
dependencies:
# build
- jom
- cmake
- ccache
- m2-coreutils
# host
- python
- cython
- swig
- fftw
- numpy
- doxygen 1.8.14
- khronos-opencl-icd-loader
# test
- pytest
- pytest-xdist
- pytest-timeout
19 changes: 19 additions & 0 deletions devtools/ci/gh-actions/conda-envs/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build
channels:
- conda-forge
dependencies:
# build
- cmake
- ccache
# host
- python
- pip
- numpy
- cython
- swig
- doxygen 1.8.14
- pip:
- sphinx==2.3.1
- sphinxcontrib-bibtex<2.0.0
- sphinxcontrib-lunrsearch
- sphinxcontrib-autodoc_doxygen
24 changes: 24 additions & 0 deletions devtools/ci/gh-actions/scripts/install_amd_opencl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This script installs AMD's SDK 3.0 to provide their OpenCL implementation
# * Installation path will be ${GITHUB_WORKSPACE}/AMDAPPSDK

set -euxo pipefail


wget -q --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries 5 \
http://s3.amazonaws.com/omnia-ci/AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2
tar -xjf AMD-APP-SDK*.tar.bz2

AMDAPPSDK=${GITHUB_WORKSPACE}/AMDAPPSDK
export OPENCL_VENDOR_PATH=${AMDAPPSDK}/etc/OpenCL/vendors

mkdir -p ${OPENCL_VENDOR_PATH}
sh AMD-APP-SDK*.sh --tar -xf -C ${AMDAPPSDK}
echo libamdocl64.so > ${OPENCL_VENDOR_PATH}/amdocl64.icd

export LD_LIBRARY_PATH=${AMDAPPSDK}/lib/x86_64:${LD_LIBRARY_PATH:-}
chmod +x ${AMDAPPSDK}/bin/x86_64/clinfo
${AMDAPPSDK}/bin/x86_64/clinfo
sudo apt-get install -y libgl1-mesa-dev

echo "OPENCL_VENDOR_PATH=${OPENCL_VENDOR_PATH}" >> ${GITHUB_ENV}
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> ${GITHUB_ENV}