Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow with Actions #16

Merged
merged 5 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions .github/workflows/build-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Hewwo! -Raltyro

name: Build Nightly
on:
workflow_dispatch:
push:

jobs:
build:
strategy:
fail-fast: false
matrix:
compile: [linux, mac, windows]
build: [release, 32bit, debug]
exclude:
- compile: linux
build: 32bit

- compile: mac
build: 32bit

include:
- compile: linux
os: ubuntu-latest
folder: linux

- compile: mac
os: macOS-latest
folder: macos

- compile: windows
os: windows-latest
folder: windows

name: ${{ matrix.compile }}-${{ matrix.build }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Haxe
uses: krdlab/setup-haxe@master
with:
haxe-version: 4.2.5

- name: Restore action cache
uses: actions/cache@v3
with:
key: cache-${{ matrix.compile }}-${{ matrix.build }}
path: |
export/${{ matrix.build }}/${{ matrix.folder }}/haxe/
export/${{ matrix.build }}/${{ matrix.folder }}/obj/
.haxelib/

- name: Setup Haxelib
run: |
haxelib setup .haxelib/
haxelib --global update haxelib --quiet
haxelib install hxcpp --quiet
haxelib install format --quiet
haxelib install hxp --quiet

- name: Install hxcpp-debug-server
if: ${{ matrix.build == 'debug' }}
run: haxelib install hxcpp-debug-server --quiet

- name: Install platform-specific distributes (linux)
if: ${{ matrix.compile == 'linux' }}
run: |
sudo apt-get install libvlc-dev
sudo apt-get install libvlccore-dev
sudo apt-get install glibc-source
sudo apt-get install libidn12
sudo apt-get install libidn-dev

- name: Install haxelibs
run: haxe -cp dev -D analyzer-optimize -main Update --interp

- name: Compile (32-bit)
if: ${{ matrix.build == '32bit' }}
run: haxelib run openfl build ${{ matrix.compile }} -${{ matrix.build }} -D HXCPP_M32 -32

- name: Compile (64-bit)
if: ${{ matrix.build != '32bit' }}
run: haxelib run openfl build ${{ matrix.compile }} -${{ matrix.build }} -64

- name: Uploading artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.compile }}-${{ matrix.build }}
path: export/${{ matrix.build }}/${{ matrix.folder }}/bin
if-no-files-found: error

- name: Uploading artifact (executable windows)
if: ${{ matrix.compile == 'windows' }}
uses: actions/upload-artifact@v3
with:
name: executableOnly-${{ matrix.compile }}-${{ matrix.build }}
path: export/${{ matrix.build }}/${{ matrix.folder }}/bin/CrowEngine.exe

- name: Uploading artifact (executable unix)
if: ${{ matrix.compile == 'linux' }}
uses: actions/upload-artifact@v3
with:
name: executableOnly-${{ matrix.compile }}-${{ matrix.build }}
path: export/${{ matrix.build }}/${{ matrix.folder }}/bin/CrowEngine

- name: Clearing already existing cache
uses: actions/github-script@v6
with:
script: |
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
if (cache.key == "cache-${{ matrix.compile }}-${{ matrix.build }}") {
await github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
}

- name: Uploading new cache
uses: actions/cache@v3
with:
key: cache-${{ matrix.compile }}-${{ matrix.build }}
path: |
export/${{ matrix.build }}/${{ matrix.folder }}/haxe/
export/${{ matrix.build }}/${{ matrix.folder }}/obj/
.haxelib/

42 changes: 42 additions & 0 deletions .github/workflows/publish-nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Nightly Builds
on:
workflow_run:
workflows:
- Build Nightly
types:
- completed

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2.26.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
skip_unpack: true
path: ./artifacts

- name: Delete tag and release
uses: dev-drprasad/delete-tag-and-release@v0.2.0
with:
delete_release: true
tag_name: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: nightly
name: Nightly Builds
prerelease: false
files: ./artifacts/*
body: |
This is an automatic nightly release of Crow Engine
if you encounter any bugs in this release, please report it to the Discord Server #bug-reports AND/OR Make an issue in the github repo
thank you for using Crow Engine!
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading