diff --git a/.gitattributes b/.gitattributes index b2422412..bd9edb4d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,3 +10,4 @@ CMakeLists.txt text # distribution archives /.github export-ignore +/builds/ci export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f4263f1..03f82a0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,30 +15,66 @@ defaults: shell: bash jobs: - linux-gcc: - name: Build (Ubuntu 20.04 LTS x86_64, GCC, SDL1.2) - runs-on: ubuntu-20.04 + prepare: + runs-on: ubuntu-latest + outputs: + short_sha: ${{ steps.vars.outputs.short_sha }} + - name: Set outputs + id: vars + run: echo "short_sha=$(git rev-parse --short \"$GITHUB_SHA\")" >> $GITHUB_OUTPUT + - name: Check outputs + run: echo ${{ steps.vars.outputs.short_sha }} + dist: + name: Distribution archives + needs: prepare + runs-on: ubuntu-latest steps: - name: Install dependencies run: | sudo apt-get update -yqq - sudo apt-get install -yqq build-essential libsdl1.2-dev + sudo apt-get install -yqq git asciidoctor w3m + + - name: Checkout + uses: actions/checkout@v4 + + - name: Generate Archives + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} + run: | + builds/ci/adoc2man ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > OpenJazz.6 + git archive -o openjazz-${SHORT_SHA}.tar.gz \ + --prefix=openjazz-${SHORT_SHA}/res/unix/ --add-file=OpenJazz.6 \ + --prefix=openjazz-${SHORT_SHA}/ ${GITHUB_SHA} + git archive -o openjazz-${SHORT_SHA}.zip --prefix=openjazz-${SHORT_SHA}/ ${GITHUB_SHA} - - name: Prepare Environment + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: openjazz-dist + path: openjazz-*.* + + linux-gcc: + name: Build (Ubuntu x86_64, GCC, SDL1.2) + needs: prepare + runs-on: ubuntu-latest + steps: + - name: Install dependencies run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV + sudo apt-get update -yqq + sudo apt-get install -yqq build-essential libsdl1.2-dev - name: Checkout uses: actions/checkout@v4 - name: Build OpenJazz (normal) run: | + export MAKEFLAGS=-j$(nproc) make ls -l OpenJazz linux-clang: name: Build (Ubuntu 20.04 LTS x86_64, Clang, SDL2) + needs: prepare runs-on: ubuntu-20.04 steps: - name: Install dependencies @@ -47,10 +83,6 @@ jobs: sudo apt-get install -yqq build-essential cmake ninja-build clang-10 \ libsdl2-dev asciidoctor w3m - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 @@ -59,16 +91,17 @@ jobs: export CXX=clang++ export CXXFLAGS="-Wall -O2 -g -ffunction-sections -fdata-sections" export LDFLAGS="-Wl,--gc-sections" - cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release - cmake --build build - ls -l build/OpenJazz + cmake --workflow --preset release + ls -l build-release/OpenJazz + build-release/OpenJazz --version - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | mkdir OJ-${SHORT_SHA} - asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc - w3m -dump -cols 2147483647 -s OpenJazzManual.html > OJ-${SHORT_SHA}/Manual.txt - cp build/OpenJazz README.md COPYING licenses.txt OJ-${SHORT_SHA}/ + builds/ci/adoc2txt ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > OJ-${SHORT_SHA}/Manual.txt + cp build-release/OpenJazz README.md COPYING licenses.txt OJ-${SHORT_SHA}/ - name: Upload artifact uses: actions/upload-artifact@v3 @@ -78,6 +111,7 @@ jobs: windows-mingw-gcc: name: Build (Windows x86_64, MinGW, GCC) + needs: prepare runs-on: windows-2019 defaults: run: @@ -91,10 +125,6 @@ jobs: pacboy: | toolchain:p cmake:p ninja:p SDL2:p asciidoctor:p - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 @@ -103,15 +133,13 @@ jobs: cmake --workflow --preset release - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build-release --prefix $PWD cp /mingw64/bin/SDL2.dll dist/ - asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc - w3m -dump -cols 2147483647 -s OpenJazzManual.html > dist/Manual.txt - cp README.md dist/README.txt - cp COPYING dist/COPYING.txt - cp licenses.txt dist/ - unix2dos dist/*.txt + builds/ci/adoc2html ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > dist/OpenJazzManual.html + builds/ci/docs2dist dist mv dist OJ-${SHORT_SHA} - name: Upload artifact @@ -122,6 +150,7 @@ jobs: wii-devkitppc: name: Build (Wii, devkitPPC) + needs: prepare runs-on: ubuntu-latest container: devkitpro/devkitppc:latest steps: @@ -130,10 +159,6 @@ jobs: sudo apt-get update -qq sudo apt-get install -yqq ninja-build dos2unix asciidoctor w3m - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 @@ -143,14 +168,12 @@ jobs: cmake --build build - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build --prefix $PWD - asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc - w3m -dump -cols 2147483647 -s OpenJazzManual.html > OpenJazz/Manual.txt - cp README.md OpenJazz/README.txt - cp COPYING OpenJazz/COPYING.txt - cp licenses.txt OpenJazz/ - unix2dos OpenJazz/*.txt + builds/ci/adoc2txt ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > OpenJazz/Manual.txt + builds/ci/docs2dist OpenJazz mv OpenJazz OJ-${SHORT_SHA} - name: Upload artifact @@ -161,6 +184,7 @@ jobs: n3ds-devkitarm: name: Build (3DS, devkitARM) + needs: prepare runs-on: ubuntu-latest container: devkitpro/devkitarm:latest steps: @@ -169,10 +193,6 @@ jobs: sudo apt-get update -qq sudo apt-get install -yqq ninja-build dos2unix asciidoctor w3m - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 @@ -182,14 +202,12 @@ jobs: cmake --build build - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build --prefix $PWD - asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc - w3m -dump -cols 2147483647 -s OpenJazzManual.html > OpenJazz/Manual.txt - cp README.md OpenJazz/README.txt - cp COPYING OpenJazz/COPYING.txt - cp licenses.txt OpenJazz/ - unix2dos OpenJazz/*.txt + builds/ci/adoc2txt ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > OpenJazz/Manual.txt + builds/ci/docs2dist OpenJazz mv OpenJazz OJ-${SHORT_SHA} - name: Upload artifact @@ -200,6 +218,7 @@ jobs: riscos-gccsdk: name: Build (RISC OS, GCCSDK 4.7) + needs: prepare runs-on: ubuntu-latest container: riscosdotinfo/riscos-gccsdk-4.7:latest steps: @@ -208,10 +227,6 @@ jobs: apt-get update -qq apt-get install -yqq cmake ninja-build - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Prepare GCCSDK autobuilder and build SDL run: | cp /usr/bin/false /usr/bin/automake-1.11 # autobuilder wants this, sdl does not need it @@ -231,6 +246,8 @@ jobs: cmake --build build - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build --prefix $PWD cp README.md COPYING licenses.txt !OpenJazz/ @@ -245,6 +262,7 @@ jobs: psp-pspdev: name: Build (PSP, pspdev) + needs: prepare runs-on: ubuntu-latest container: pspdev/pspdev:latest steps: @@ -252,10 +270,6 @@ jobs: run: | apk add cmake ninja asciidoctor w3m - - name: Prepare Environment - run: | - echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 @@ -265,14 +279,12 @@ jobs: cmake --build --preset=psp-release - name: Prepare artifact + env: + SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build-psp-release --prefix $PWD - asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc - w3m -dump -cols 2147483647 -s OpenJazzManual.html > OpenJazz/Manual.txt - cp README.md OpenJazz/README.txt - cp COPYING OpenJazz/COPYING.txt - cp licenses.txt OpenJazz/ - unix2dos OpenJazz/*.txt + builds/ci/adoc2txt ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > OpenJazz/Manual.txt + builds/ci/docs2dist OpenJazz mv OpenJazz OJ-${SHORT_SHA} - name: Upload artifact @@ -280,3 +292,32 @@ jobs: with: name: openjazz-psp path: OJ-*/ + + prerelease: + name: Create Pre-Release + needs: + # all + - dist + - linux-clang + - windows-mingw-gcc + - wii-devkitppc + - n3ds-devkitarm + - riscos-gccsdk + - psp-pspdev + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: Inspect directory after downloading artifacts + run: ls -alFR + + - name: Create release (on master branch) and upload artifacts + #if: github.ref == 'refs/heads/master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CHANGELOG_TYPE: standard + run: | + wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage + chmod +x pyuploadtool-x86_64.AppImage + ./pyuploadtool-x86_64.AppImage OpenJazz-*.* diff --git a/builds/ci/adoc2html b/builds/ci/adoc2html new file mode 100755 index 00000000..d7b075cc --- /dev/null +++ b/builds/ci/adoc2html @@ -0,0 +1,5 @@ +#!/bin/sh + +test -z $1 && exit 1 + +exec asciidoctor -a oj_version=$release -b html5 - diff --git a/builds/ci/adoc2man b/builds/ci/adoc2man new file mode 100755 index 00000000..f79a7bad --- /dev/null +++ b/builds/ci/adoc2man @@ -0,0 +1,5 @@ +#!/bin/sh + +test -z $1 && exit 1 + +exec asciidoctor -a oj_version=$release -b manpage - diff --git a/builds/ci/adoc2txt b/builds/ci/adoc2txt new file mode 100755 index 00000000..e3cd6c24 --- /dev/null +++ b/builds/ci/adoc2txt @@ -0,0 +1,6 @@ +#!/bin/sh + +test -z $1 && exit 1 + +exec asciidoctor -a oj_version=$release -b html5 - | \ + w3m -dump -cols 2147483647 -s -T text/html diff --git a/builds/ci/docs2dist b/builds/ci/docs2dist new file mode 100755 index 00000000..0d0eca0c --- /dev/null +++ b/builds/ci/docs2dist @@ -0,0 +1,8 @@ +#!/bin/sh + +test -z $1 && exit 1 + +cp README.md $1/README.txt +cp COPYING $1/COPYING.txt +cp licenses.txt $1/ +unix2dos $1/*.txt