-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (56 loc) · 2.36 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [ubuntu-latest, ubuntu-rolling, fedora-latest, cuda-12.1]
compiler: [gcc, clang]
include:
- build: ubuntu-latest
docker_image: ubuntu
docker_tag: latest
- build: ubuntu-rolling
docker_image: ubuntu
docker_tag: rolling
- build: fedora-latest
docker_image: fedora
docker_tag: latest
- build: cuda-12.1
docker_image: nvidia/cuda
docker_tag: 12.1.1-devel-ubuntu22.04
steps:
- uses: actions/checkout@master
- name: Prepare environment
run: |
echo -n "container_name=" >> "$GITHUB_ENV"
echo "nbody-docker-builder-${{ matrix.compiler }}-${{ matrix.docker_image }}-${{ matrix.docker_tag }}" | sed -r 's/[^A-Za-z0-9-]/-/g' >> "$GITHUB_ENV"
- name: Install Docker (if not present)
run: |
apt-get -q -o=Dpkg::Use-Pty=0 update && apt-get -q -o=Dpkg::Use-Pty=0 -y dist-upgrade && apt-get -q -o=Dpkg::Use-Pty=0 -y install docker.io || true
- name: Destroy old container
run: |
docker rm -f ${{ env.container_name }}
- name: Launch container
run: |
docker run -d --rm --name ${{ env.container_name }} -e LC_ALL="C" -e LANG="C" ${{ matrix.docker_image }}:${{ matrix.docker_tag }} tail -f /dev/null
docker ps
- name: Copy source tree
run: |
docker cp ${{ github.workspace }} ${{ env.container_name }}:/build
- name: Install dependencies
run: |
docker exec -w /build -e COMPILER=${{ matrix.compiler }} -e IMAGE=${{ matrix.docker_image }} -e IMAGE_TAG=${{ matrix.docker_tag }} -t ${{ env.container_name }} bash .github/install.sh
docker exec -w /build -e COMPILER=${{ matrix.compiler }} -e IMAGE=${{ matrix.docker_image }} -e IMAGE_TAG=${{ matrix.docker_tag }} -t ${{ env.container_name }} bash .github/install-post.sh
- name: Build and run project
run: |
docker exec -w /build -e COMPILER=${{ matrix.compiler }} -e IMAGE=${{ matrix.docker_image }} -e IMAGE_TAG=${{ matrix.docker_tag }} -t ${{ env.container_name }} bash .github/script.sh
- name: Destroy container
run: |
docker rm -f ${{ env.container_name }}