瀏覽代碼

ci: use Docker image

Note that Docker image does not contain any Python dependencies because
as of today, some dependencies are held in the repository and installed
as editable. This makes things a bit trickier. We could potentially
cache pip cache if it becomes too slow, but still, we would not be able
to easily rely on cache-hit to not run pip install because of such
editable dependencies.

Note: see https://github.com/actions/runner-images/issues/6775 for the
git safe.directory requirement.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Gerard Marull-Paretas 2 月之前
父節點
當前提交
aad8c35fd2
共有 2 個文件被更改,包括 14 次插入52 次删除
  1. 7 27
      .github/workflows/build.yml
  2. 7 25
      .github/workflows/test.yml

+ 7 - 27
.github/workflows/build.yml

@@ -18,48 +18,28 @@ on:
       - 'waf'
       - 'wscript'
 
-env:
-  ARM_GNU_TOOLCHAIN_VERSION: 14.2.rel1
-  EM_VERSION: 4.0.1
-  EM_CACHE_FOLDER: 'emsdk-cache'
-
 jobs:
   build:
     runs-on: ubuntu-24.04
+    container:
+      image: ghcr.io/pebble-dev/pebbleos-docker:v1
     strategy:
       matrix:
         board: ["snowy_bb2", "spalding_bb2", "silk_bb2", "asterix"]
     steps:
+      - name: Mark Github workspace as safe
+        run: git config --system --add safe.directory "${GITHUB_WORKSPACE}" 
+
       - name: Checkout
         uses: actions/checkout@v4
         with:
           fetch-depth: 0
           submodules: true
 
-      - name: Setup emsdk cache
-        id: cache-emsdk
-        uses: actions/cache@v4
-        with:
-          path: ${{env.EM_CACHE_FOLDER}}
-          key: emsdk-${{env.EM_VERSION}}-${{ runner.os }}
-
-      - uses: actions/setup-python@v5
-        with:
-          python-version: "3.13"
-
-      - name: Set up environment
+      - name: Install Python dependencies
         run: |
-          sudo apt-get update
-          sudo apt-get install -y gettext gcc-multilib
+          pip install -U pip
           pip install -r requirements.txt
-          wget --no-verbose "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GNU_TOOLCHAIN_VERSION}/binrel/arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz"
-          sudo tar xf arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz -C /opt
-          echo "/opt/arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi/bin" >> $GITHUB_PATH
-
-      - uses: mymindstorm/setup-emsdk@v14
-        with:
-          version: ${{env.EM_VERSION}}
-          actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
 
       - name: Configure
         run: ./waf configure --board ${{ matrix.board }}

+ 7 - 25
.github/workflows/test.yml

@@ -18,45 +18,27 @@ on:
       - 'wscript'
 
 env:
-  ARM_GNU_TOOLCHAIN_VERSION: 14.2.rel1
-  EM_VERSION: 4.0.1
-  EM_CACHE_FOLDER: 'emsdk-cache'
   TEST_BOARD: 'snowy_bb2'
 
 jobs:
   build:
     runs-on: ubuntu-24.04
+    container:
+      image: ghcr.io/pebble-dev/pebbleos-docker:v1
     steps:
+      - name: Mark Github workspace as safe
+        run: git config --system --add safe.directory "${GITHUB_WORKSPACE}" 
+
       - name: Checkout
         uses: actions/checkout@v4
         with:
           fetch-depth: 0
           submodules: true
 
-      - name: Setup emsdk cache
-        id: cache-emsdk
-        uses: actions/cache@v4
-        with:
-          path: ${{env.EM_CACHE_FOLDER}}
-          key: emsdk-${{env.EM_VERSION}}-${{ runner.os }}
-
-      - uses: actions/setup-python@v5
-        with:
-          python-version: "3.13"
-
-      - name: Set up environment
+      - name: Install Python dependencies
         run: |
-          sudo apt-get update
-          sudo apt-get install -y gettext gcc-multilib
+          pip install -U pip
           pip install -r requirements.txt
-          wget --no-verbose "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GNU_TOOLCHAIN_VERSION}/binrel/arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz"
-          sudo tar xf arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz -C /opt
-          echo "/opt/arm-gnu-toolchain-${ARM_GNU_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi/bin" >> $GITHUB_PATH
-
-      - uses: mymindstorm/setup-emsdk@v14
-        with:
-          version: ${{env.EM_VERSION}}
-          actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
 
       - name: Configure
         run: ./waf configure --board ${{env.TEST_BOARD}}