From 24591875d804ba409509002975f039d96c7d8286 Mon Sep 17 00:00:00 2001 From: SourLemonJuice Date: Tue, 25 Jun 2024 18:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BCI=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Build.yml | 65 +++++++++++++++++++++++++++---------- source/GNUmakefile | 6 ++-- source/full_test.sh | 2 ++ 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 1a39574..1f34c8c 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -15,23 +15,32 @@ on: env: CI_HOST_INFO: GitHub Build Workflow +defaults: + run: + working-directory: source/ + jobs: - build: + Unit-Testing: runs-on: ubuntu-latest - defaults: - run: - working-directory: ./source/ - steps: - uses: actions/checkout@v4 - - name: Build with make in Linux(Ubuntu) - run: make i18nglish.out build_host_description="${CI_HOST_INFO} ID:${GITHUB_RUN_ID} for ${GITHUB_REF}" "${{ inputs.make_build_arg1 }}" - - name: End test(script) - run: ./full_test.sh - name: Build unit test - run: make test + run: make test.out - name: Unit testing run: ./test.out + - name: Upload unit-test exec file + uses: actions/upload-artifact@v4 + with: + name: i18nglish-unit-test-linux + path: source/test.out + + Build-for-Linux: + runs-on: ubuntu-latest + needs: [Unit-Testing] + steps: + - uses: actions/checkout@v4 + - name: Build with make in Linux(Ubuntu) + run: make i18nglish.out build_host_description="${{ env.CI_HOST_INFO }} ID:${{ github.run_id }} for ${{ github.ref }}" ${{ inputs.make_build_arg1 }} - name: Upload executable file uses: actions/upload-artifact@v4 with: @@ -40,27 +49,47 @@ jobs: if-no-files-found: error retention-days: 7 + End-to-End-Testing: + runs-on: ubuntu-latest + needs: [Unit-Testing, Build-for-Linux] + steps: + - uses: actions/checkout@v4 + - name: Download artifact(Linux) + uses: actions/download-artifact@v4 + with: + name: i18nglish-Linux(.out) + path: source/ + - name: End to End test(script) + run: ./full_test.sh + # https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md # https://www.msys2.org/docs/ci/ - build-for-windows: + Build-for-Windows: runs-on: windows-latest + needs: [Unit-Testing, End-to-End-Testing, Build-for-Linux] defaults: run: shell: msys2 {0} - working-directory: ./source/ steps: - uses: actions/checkout@v4 - uses: msys2/setup-msys2@v2 with: msystem: UCRT64 update: true - install: make git mingw-w64-ucrt-x86_64-clang + install: make git mingw-w64-ucrt-x86_64-clang tree + - name: Upload workspace snap + uses: actions/upload-artifact@v4 + with: + name: windows-build-dir-snap + path: ./ + if-no-files-found: error + retention-days: 1 + - name: pwd + run: pwd + - name: tree + run: tree ../ - name: Build with make in Windows(MSYS2) - run: make i18nglish.exe build_host_description="${CI_HOST_INFO} ID:${GITHUB_RUN_ID} for ${GITHUB_REF}" "${{ inputs.make_build_arg1 }}" - - name: Build unit test - run: make test - - name: Unit testing - run: ./test.out + run: make i18nglish.exe build_host_description="${{ env.CI_HOST_INFO }} ID:${{ github.run_id }} for ${{ github.ref }}" ${{ inputs.make_build_arg1 }} - name: Upload executable file(.exe) uses: actions/upload-artifact@v4 with: diff --git a/source/GNUmakefile b/source/GNUmakefile index 1ce761a..e6dd711 100644 --- a/source/GNUmakefile +++ b/source/GNUmakefile @@ -24,7 +24,7 @@ CFlag_clang += -DAPP_BUILD_HOST_DESCRIPTION="\"$(build_host_description)\"" CFlag_clang += -DAPP_BUILD_RELEASE_MODE="$(releaseBuild)" CFlag_clang += -DAPP_BUILD_DATE_UTC="\"$(build_date_UTC)\"" -ALL: i18nglish.out +default: i18nglish.out i18nglish.out: $(source_files) /usr/bin/clang $(source_files) \ @@ -41,10 +41,10 @@ i18nglish.exe: $(source_files) --output $(executable_base_name).exe \ $(CFlag_clang) -test: unit_test.c i7h/i7h_processor.c +test.out: unit_test.c i7h/i7h_processor.c /usr/bin/clang unit_test.c i7h/i7h_processor.c \ --output test.out \ $(CFlag_clang) -clean: +clear: rm -i ./$(executable_base_name).* diff --git a/source/full_test.sh b/source/full_test.sh index 3ef4b09..f0a6031 100755 --- a/source/full_test.sh +++ b/source/full_test.sh @@ -8,6 +8,8 @@ fi # remember, keep other command safe, but not this target. It's a Test. test_examples="'hello, world. -,hello --world,. --- lastOneNormal'" +chmod +x ./i18nglish.out | exit $? + echo Raw: "${test_examples}" # args mode