File size: 3,537 Bytes
d90b3a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Composite CPU Test Run
inputs:
  target_test_ref:
    description: 'Target ref to checkout and run CPU tests on'
    required: true
    type: string
runs:
  using: composite
  steps:
    - uses: actions/checkout@v4
      with:
        ref: ${{ inputs.target_test_ref }}
    - name: Install Python
      uses: actions/setup-python@v4
      with:
        python-version: "3.8"
        cache: "pip"
        cache-dependency-path: "**/requirements*.txt"
    - name: Upgrade Pip
      shell: bash
      run: python -m pip install --upgrade pip
    - name: Set up Docker repository
      shell: bash
      run: |
        # Add Docker's official GPG key:
        sudo apt-get update -y
        sudo apt-get install ca-certificates curl -y
        sudo install -m 0755 -d /etc/apt/keyrings
        sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
        sudo chmod a+r /etc/apt/keyrings/docker.asc
        # Add the repository to Apt sources:
        echo \
          "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
          $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
          sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
        sudo apt-get update
    - name: Docker installation
      shell: bash
      run: |
        sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
        sudo docker run hello-world
    - name: Prepare data
      shell: bash
      run: |
        python prepare_data.py -d ./data
    - name: Remove previous container
      shell: bash
      run: |
        if docker ps -a | grep -q "$CONTAINER"; then
          echo "Container already exists, deleting it..."
          docker rm -f $CONTAINER
        fi
      env:
        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
    - name: Create container
      shell: bash
      run: |
        mv docker-compose.yml .docker-compose.yml
        cp tests/cpu_tests/docker-compose.yml .
        export NEOX_DATA_PATH='./data/enwik8'
        export NEOX_CHECKPOINT_PATH='/mnt/sda/checkpoints' #todo: where do I get this?
        docker compose run -d --build --name $CONTAINER gpt-neox tail -f /dev/null
      env:
        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
    - name: Install test requirements
      shell: bash
      run: |
        docker exec $CONTAINER pip install -r /workspace/requirements-dev.txt
      env:
        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
    - name: Execute CPU tests 1
      shell: bash
      run: |
        docker exec $CONTAINER sh -c "cd gpt-neox && pytest tests -m cpu"
      env:
        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
    - name: Execute CPU tests 2
      if: always()
      shell: bash
      run: |
        docker exec $CONTAINER sh -c "cd gpt-neox && PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests -m cpu"
      env:
        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
#    - name: Generate report
#      shell: bash
#      if: always()
#      run: |
#        docker exec $CONTAINER python -m http.server --directory htmlcov 8000 # this may not work with AWS - should perhaps pass back as an artifact for Github to use instead.
#      env:
#        CONTAINER: gpt-neox-${{ inputs.target_test_ref }}
    - name: Remove CPU docker-compose
      shell: bash
      if: always()
      run: |
        rm docker-compose.yml
        mv .docker-compose.yml docker-compose.yml