Skip to content

Commit

Permalink
New workflows for the AppImage
Browse files Browse the repository at this point in the history
Also add comment to explain changes to CmakeLists.txt
  • Loading branch information
Jammyjamjamman committed Jan 30, 2025
1 parent 4fd0364 commit 162b85d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 272 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ on:
branches: develop
pull_request:
branches: develop
paths:
- '**appimage.yml'

jobs:
build-mg-appimage:
Expand Down Expand Up @@ -54,9 +52,24 @@ jobs:
PLATFORM=$(uname -m)
echo "ARTIFACT_NAME=AppImages-${PLATFORM//\//-}" >> $GITHUB_ENV
- name: Upload AppImage
- if: ${{ github.ref != 'refs/heads/develop' }}
name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./*AppImage*
if-no-files-found: error

- if: ${{ github.ref == 'refs/heads/develop' }}
name: 'Prerelease'
uses: ncipollo/release-action@v1
with:
artifacts: "./*AppImage*"
body: "MegaGlest Snapshot Release"
allowUpdates: true
prerelease: true
removeArtifacts: false
replacesArtifacts: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
tag: snapshot
22 changes: 4 additions & 18 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ on:
branches: [ develop ]
pull_request:
branches: [ develop ]
workflow_run:
workflows: [Docker Image]
types: [completed]
branches: [develop]

jobs:
build-linux:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -51,7 +46,6 @@ jobs:
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -121,27 +115,18 @@ jobs:
$7zPath = $(Get-Command 7z).Source
cp $7zPath .
Remove-Item glest-dev.ini
Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-$env:VERSION-x64-windows.zip
Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-x64-windows.zip
cd ../..
- name: Create MegaGlest Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
uses: actions/upload-artifact@v4
with:
name: megaglest-x64-windows
name: megaglest-x64-windows-archive
retention-days: 1
path: mk/windoze/*.zip

on-dockerbuild-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: |
echo 'The triggering workflow failed'
exit 1
build-macos:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
runs-on: macos-latest
Expand All @@ -168,7 +153,7 @@ jobs:
cd mk/macos
./make-binary-archive.sh
cd -
mv release/mg-binary-macos*.tar.bz2 release/megaglest-$VERSION-x64-macos.tar.bz2
mv release/mg-binary-macos*.tar.bz2 release/megaglest-x64-macos.tar.bz2
- name: Create MegaGlest Snapshot
if: ${{ github.ref == 'refs/heads/develop' }}
Expand All @@ -177,3 +162,4 @@ jobs:
name: megaglest-x64-macos
retention-days: 1
path: release/*.tar.bz2

39 changes: 0 additions & 39 deletions .github/workflows/docker.yml

This file was deleted.

84 changes: 0 additions & 84 deletions .github/workflows/prerelease.yml

This file was deleted.

93 changes: 22 additions & 71 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,7 @@ on:

# The artifact only runs on the same distro that it was built on.
jobs:
appimage-snapshot:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container: megaglest/megaglest-build-env:bionic
steps:
- uses: actions/checkout@v4

- name: Git Hash
run: |
# Required because docker user is root.
git config --global safe.directory $GITHUB_WORKSPACE
echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build
run: mk/linux/build-appimage.sh

- name: Pack
run: |
cd mk/linux/
mv g2xml g2xml-$VERSION
mv xml2g xml2g-$VERSION
tar cfJ megaglest-$VERSION-x64-appimage.tar.xz *.AppImage g2xml-* xml2g-*
- name: Create MegaGlest Snapshot
uses: actions/upload-artifact@v4
with:
name: megaglest-x64-ubuntu
retention-days: 1
path: |
mk/linux/*.tar.xz
transfer-macos-snapshot:
release:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -67,55 +36,37 @@ jobs:
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/megaglest-x64-macos.zip`, Buffer.from(download.data));
- name: 'Prepare artifacts'
run: |
unzip megaglest-x64-macos.zip
rm megaglest-x64-macos.zip
- name: Create MegaGlest MacOS Snapshot
uses: actions/upload-artifact@v4
with:
name: megaglest-x64-macos
retention-days: 1
path: |
*.tar.bz2
transfer-windows-snapshot:
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "megaglest-x64-windows"
matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "megaglest-x64-windows-archive"
})[0];
let download = await github.rest.actions.downloadArtifact({
download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/megaglest-x64-windows.zip`, Buffer.from(download.data));
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/megaglest-x64-windows-archive.zip`, Buffer.from(download.data));
- name: 'Prepare artifacts'
run: |
unzip megaglest-x64-windows.zip
rm megaglest-x64-windows.zip
- name: Create MegaGlest Windows Snapshot
uses: actions/upload-artifact@v4
unzip megaglest-x64-windows-archive.zip
unzip megaglest-x64-macos.zip
rm megaglest-x64-windows-archive.zip megaglest-x64-macos.zip
- name: 'Prerelease'
uses: ncipollo/release-action@v1
with:
name: megaglest-x64-windows
retention-days: 1
path: |
*.zip
artifacts: "*.zip,*.tar.bz2"
body: "MegaGlest Snapshot Release"
allowUpdates: true
prerelease: true
removeArtifacts: false
replacesArtifacts: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
tag: snapshot


on-failure:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ include(CheckCCompilerFlag)

# Define your extra flags in a list
set(EXTRA_FLAGS
# https://github.com/MegaGlest/megaglest-source/issues/275
"-Werror=odr"
"-Werror=lto-type-mismatch"
"-Werror=strict-aliasing"
Expand Down
Loading

0 comments on commit 162b85d

Please sign in to comment.