1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements.  See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership.  The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License.  You may obtain a copy of the License at
8#
9#   http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied.  See the License for the
15# specific language governing permissions and limitations
16# under the License.
17
18name: CI
19on: [push, pull_request]
20defaults:
21  run:
22    shell: bash
23
24jobs:
25  build-and-run-examples:
26    runs-on: ubuntu-20.04
27    container: teaclave/teaclave-trustzone-sdk-build:0.2.1
28    steps:
29      - name: Checkout repository
30        uses: actions/checkout@v2
31        with:
32          submodules: recursive
33      - name: Setting up $HOME
34        run: |
35          cp /root/.bashrc $HOME/.bashrc &&
36          ln -sf /root/.rustup ~/.rustup &&
37          ln -sf /root/.cargo ~/.cargo
38      - name: Building
39        run: |
40          source environment &&
41          make optee &&
42          . ~/.cargo/env &&
43          rustup default nightly-2019-07-08 &&
44          make examples
45      - name: Run tests and examples
46        run: |
47          cd ci && ./ci.sh
48  build-utee-teec:
49    runs-on: ubuntu-20.04
50    container: teaclave/teaclave-trustzone-sdk-build:0.2.0
51    steps:
52      - name: Checkout repository
53        uses: actions/checkout@v2
54        with:
55          submodules: recursive
56      - name: Setting up $HOME
57        run: |
58          cp /root/.bashrc $HOME/.bashrc &&
59          ln -sf /root/.rustup ~/.rustup &&
60          ln -sf /root/.cargo ~/.cargo
61      - name: Building
62        run: |
63          source environment &&
64          make optee &&
65          . ~/.cargo/env &&
66          rustup default nightly-2019-07-08 &&
67          (cd optee-utee && xargo build --target aarch64-unknown-optee-trustzone -vv) &&
68          (cd optee-teec && cargo build --target aarch64-unknown-linux-gnu -vv)
69  build-and-run-examples-in-OPTEE-repo:
70    runs-on: ubuntu-20.04
71    container: teaclave/teaclave-trustzone-sdk-build:0.2.1
72    steps:
73      - name: Checkout OP-TEE repository
74        run: |
75          mkdir -p ~/bin
76          curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo && chmod a+x ~/bin/repo
77          export PATH=~/bin:$PATH
78          mkdir optee-qemuv8 && cd optee-qemuv8 &&
79          repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml &&
80          repo sync -j4 --no-clone-bundle
81      # This step will be removed after merging those commits to upstream:
82      - name: Switch to current commits
83        run: |
84          cd optee-qemuv8
85          (cd optee_rust && git fetch github pull/45/head && git checkout FETCH_HEAD)
86          (cd build && git fetch https://github.com/DemesneGH/build.git && git checkout FETCH_HEAD)
87      - name: Build images
88        run: |
89          cd optee-qemuv8
90          cd build &&
91          make -j2 toolchains &&
92          make OPTEE_RUST_ENABLE=y CFG_TEE_RAM_VA_SIZE=0x00300000
93      - name: Test Rust applications
94        run: |
95          cd optee-qemuv8
96          cd build && make CFG_TEE_CORE_LOG_LEVEL=0 check-rust
97  license:
98    runs-on: ubuntu-20.04
99    steps:
100      - uses: actions/checkout@v2
101      - name: Check License Header
102        uses: apache/skywalking-eyes@main
103