|
| 1 | +name: Test ArchLinux |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'main' |
| 6 | + - 'releases/**' |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + # ArchLinux does not come with an image combining root and boot partitions |
| 12 | + # This shows how to proceed and could be combined with cache. |
| 13 | + test_archlinux: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Prepare ArchLinux image |
| 18 | + run: | |
| 19 | + # https://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2 |
| 20 | + # Install dependency |
| 21 | + sudo apt-get -y install libarchive-tools |
| 22 | + # Create a 1.5 GB image |
| 23 | + dd if=/dev/zero of=$RUNNER_TEMP/archlinux.img bs=1M count=1536 |
| 24 | + # 2. At the fdisk prompt, delete old partitions and create a new one: |
| 25 | + # using the sed comment trick of https://superuser.com/a/984637 |
| 26 | + sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk $RUNNER_TEMP/archlinux.img |
| 27 | + o # clear the in memory partition table |
| 28 | + n # new partition |
| 29 | + p # primary partition |
| 30 | + 1 # partition number 1 |
| 31 | + # default - start at beginning of disk |
| 32 | + +200M # 200 MB boot partition |
| 33 | + t # type |
| 34 | + c # W95 FAT32 (LBA) |
| 35 | + n # new partition |
| 36 | + p # primary partition |
| 37 | + 2 # partion number 2 |
| 38 | + # default, start immediately after preceding partition |
| 39 | + # default, extend partition to end of disk |
| 40 | + w # write the partition table |
| 41 | + q # and we're done |
| 42 | + EOF |
| 43 | + # create loopdev |
| 44 | + loopdev=$(sudo losetup --find --show --partscan $RUNNER_TEMP/archlinux.img) |
| 45 | + # 3. Create and mount the FAT filesystem: |
| 46 | + sudo mkfs.vfat ${loopdev}p1 |
| 47 | + mkdir boot |
| 48 | + sudo mount ${loopdev}p1 boot |
| 49 | + # 4. Create and mount the ext4 filesystem: |
| 50 | + sudo mkfs.ext4 ${loopdev}p2 |
| 51 | + mkdir root |
| 52 | + sudo mount ${loopdev}p2 root |
| 53 | + # 5. Download and extract the root filesystem: |
| 54 | + wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz |
| 55 | + sudo -u root bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root |
| 56 | + sync |
| 57 | + # 6. Move boot files to the first partition: |
| 58 | + sudo mv root/boot/* boot |
| 59 | + # 7. Unmount the two partitions: |
| 60 | + sudo umount boot root |
| 61 | + # Cleanup |
| 62 | + rm ArchLinuxARM-rpi-armv7-latest.tar.gz |
| 63 | + rmdir boot |
| 64 | + rmdir root |
| 65 | + - uses: ./ # pguyot/arm-runner-action@HEAD |
| 66 | + with: |
| 67 | + base_image: file://$RUNNER_TEMP/archlinux.img |
| 68 | + cpu: cortex-a53 |
| 69 | + commands: | |
| 70 | + # 10. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys: |
| 71 | + pacman-key --init |
| 72 | + pacman-key --populate archlinuxarm |
0 commit comments