Skip to content

Commit

Permalink
Reduce repetitive code in workflows
Browse files Browse the repository at this point in the history
Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com>
  • Loading branch information
ElectricalBoy and Ocraftyone committed Jul 1, 2024
1 parent 1dd57a0 commit 1e774b6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 60 deletions.
39 changes: 13 additions & 26 deletions .github/workflows/build_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,17 @@ jobs:
brew install zstd
- name: Install Dependencies (Ubuntu 20.04)
if: inputs.os == 'ubuntu-20.04'
working-directory: ${{ github.workspace }}
run: |
apt-fast update
apt-fast install -y cmake git g++ build-essential libgl1-mesa-dev m4 \
libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \
libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.0-dev \
libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-bad libosmesa6-dev wget sudo autoconf curl libunwind-dev texinfo
- name: Install Dependencies (Ubuntu 24.04)
if: inputs.os == 'ubuntu-24.04'
- name: Install Ubuntu Build Dependencies
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }}
env:
apt-cmd: ${{ (inputs.os == 'ubuntu-20.04' && 'apt-fast') || (inputs.os == 'ubuntu-24.04' && 'sudo apt-get') || '' }}
webkit-ver: ${{ (inputs.os == 'ubuntu-20.04' && '4.0') || (inputs.os == 'ubuntu-24.04' && '4.1') || '' }}
run: |
sudo apt-get update
sudo apt-get install -y cmake git g++ build-essential libgl1-mesa-dev m4 \
${{ env.apt-cmd }} update
${{ env.apt-cmd }} install -y cmake git g++ build-essential libgl1-mesa-dev m4 \
libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \
libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.1-dev \
libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-${{ env.webkit-ver }}-dev \
libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-bad libosmesa6-dev wget sudo autoconf curl libunwind-dev texinfo
Expand Down Expand Up @@ -132,18 +124,13 @@ jobs:
name: OrcaSlicer_dep_win64_${{ env.date }}
path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep*.zip

- name: Upload Ubuntu 20.04 artifacts
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' }}
uses: actions/upload-artifact@v4
with:
name: OrcaSlicer_dep_ubuntu_${{ env.date }}
path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep_ubuntu_*.tar.gz

- name: Upload Ubuntu 24.04 artifacts
if: ${{ ! env.ACT && inputs.os == 'ubuntu-24.04' }}
- name: Upload Ubuntu artifacts
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' }}
env:
ubuntu-ver: ${{ (inputs.os == 'ubuntu-20.04' && '2004') || (inputs.os == 'ubuntu-24.04' && '2404') || '' }}
uses: actions/upload-artifact@v4
with:
name: OrcaSlicer_dep_ubuntu_2404_${{ env.date }}
name: OrcaSlicer_dep_ubuntu_${{ env.ubuntu-ver }}_${{ env.date }}
path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep_ubuntu_*.tar.gz

build_orca:
Expand Down
49 changes: 15 additions & 34 deletions .github/workflows/build_orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,17 @@ jobs:

# Ubuntu
- name: Install dependencies
if: inputs.os == 'ubuntu-20.04'
run: |
apt-fast update
apt-fast install -y autoconf build-essential cmake curl eglexternalplatform-dev \
extra-cmake-modules file git libcairo2-dev libcurl4-openssl-dev libdbus-1-dev libglew-dev libglu1-mesa-dev \
libglu1-mesa-dev libgstreamer1.0-dev libgstreamerd-3-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgtk-3-dev libgtk-3-dev libmspack-dev libosmesa6-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \
libwebkit2gtk-4.0-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget
- name: Install dependencies
if: inputs.os == 'ubuntu-24.04'
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
env:
apt-cmd: ${{ (inputs.os == 'ubuntu-20.04' && 'apt-fast') || (inputs.os == 'ubuntu-24.04' && 'sudo apt-get') || '' }}
webkit-ver: ${{ (inputs.os == 'ubuntu-20.04' && '4.0') || (inputs.os == 'ubuntu-24.04' && '4.1') || '' }}
run: |
sudo apt-get update
sudo apt-get install -y autoconf build-essential cmake curl eglexternalplatform-dev \
${{ env.apt-cmd }} update
${{ env.apt-cmd }} install -y autoconf build-essential cmake curl eglexternalplatform-dev \
extra-cmake-modules file git libcairo2-dev libcurl4-openssl-dev libdbus-1-dev libglew-dev libglu1-mesa-dev \
libglu1-mesa-dev libgstreamer1.0-dev libgstreamerd-3-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgtk-3-dev libgtk-3-dev libmspack-dev libosmesa6-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \
libwebkit2gtk-4.1-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget libfuse2t64
libwebkit2gtk-${{ env.webkit-ver }}-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget
- name: Install dependencies from BuildLinux.sh
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
Expand Down Expand Up @@ -268,38 +261,26 @@ jobs:
zip -r orca_custom_preset_tests.zip user/
- name: Upload artifacts Ubuntu
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' }}
uses: actions/upload-artifact@v4
with:
name: OrcaSlicer_Linux_${{ env.ver }}
path: './build/OrcaSlicer_Linux_${{ env.ver }}.AppImage'
- name: Upload artifacts Ubuntu
if: ${{ ! env.ACT && inputs.os == 'ubuntu-24.04' }}
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' }}
env:
ubuntu-ver: ${{ (inputs.os == 'ubuntu-20.04' && '2004') || (inputs.os == 'ubuntu-24.04' && '2404') || '' }}
uses: actions/upload-artifact@v4
with:
name: OrcaSlicer_Linux_ubuntu2404_${{ env.ver }}
name: OrcaSlicer_Linux_ubuntu_${{ env.ubuntu-ver }}_${{ env.ver }}
path: './build/OrcaSlicer_Linux_${{ env.ver }}.AppImage'

- name: Deploy Ubuntu release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' }}
env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: WebFreak001/deploy-nightly@v3.1.0
with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ./build/OrcaSlicer_Linux_${{ env.ver }}.AppImage
asset_path: ./build/OrcaSlicer_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
asset_name: OrcaSlicer_Linux_${{ env.ver }}.AppImage
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Ubuntu release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' }}
uses: WebFreak001/deploy-nightly@v3.1.0
with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ./build/OrcaSlicer_Linux_${{ env.ver }}.AppImage
asset_name: OrcaSlicer_Linux_ubuntu2404_${{ env.ver }}.AppImage
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

- name: Deploy orca_custom_preset_tests
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
Expand Down

0 comments on commit 1e774b6

Please sign in to comment.