Skip to content

Commit

Permalink
Add workflow checking that deployed repository can produce "Hello Wor…
Browse files Browse the repository at this point in the history
…ld!" executable
  • Loading branch information
Blackhex committed Feb 8, 2024
1 parent 0e7f163 commit 80e1c3f
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/build-hello-world.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

# Sanity check of the GCC binary and its version.
aarch64-w64-mingw32-gcc --version

# Create a simple "Hello, World!" program binary.
echo '#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
' > hello-world.c
aarch64-w64-mingw32-gcc -o hello-world.exe hello-world.c
18 changes: 18 additions & 0 deletions .github/scripts/install-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e # exit on error
set -x # echo on
set -o pipefail # fail of any command in pipeline is an error

pacman -Syu --noconfirm

# Add WoArm64 custom repository.
REPO='[woarm64]
Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/x86_64
SigLevel = Optional
'
echo -e "$REPO$(cat /etc/pacman.conf)" > /etc/pacman.conf

pacman -Sy --noconfirm
pacman -S mingw-w64-cross-gcc --noconfirm
49 changes: 49 additions & 0 deletions .github/workflows/check-repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Check MSYS2 repository

on:
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true

- name: Checkout repository
uses: actions/checkout@v4

- name: Install toolchain
shell: msys2 {0}
run: |
`cygpath "${{ github.workspace }}"`/.github/scripts/install-toolchain.sh
- name: Build hello-world.exe
shell: msys2 {0}
run: |
`cygpath "${{ github.workspace }}"`/.github/scripts/build-hello-world.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: hello-world
path: hello-world.exe

test:
needs: [build]
runs-on: [Windows, GCC, ARM64]

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: hello-world
path: ${{ github.workspace }}\artifacts

- name: Run hello-world.exe
run: |
ls ${{ github.workspace }}\artifacts
${{ github.workspace }}\artifacts\hello-world.exe
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,7 @@ jobs:
uses: actions/deploy-pages@v4
with:
artifact_name: woarm64-msys2-repository

check-repository:
needs: [deploy]
uses: ./.github/workflows/check-repository.yml

0 comments on commit 80e1c3f

Please sign in to comment.