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

Slightly overhaul CI workflows #454

Merged
merged 9 commits into from
Aug 16, 2023
34 changes: 28 additions & 6 deletions .github/workflows/ci-on-pull_req.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
name: CI on Pull Request to master and patchmanager3 branches
name: CI on PRs to master & patchmanager3 branches

on:
pull_request:
branches:
- master
- patchmanager3
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# Do not wait up to the default of 10 minutes for network timeouts in a workflow which runs ca. 5 minutes
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1

defaults:
run:
# Note thas 'bash' provides -o pipefail, in contrast to the default (i.e., unspecified, which also uses bash) or 'sh',
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: sh

# See, e.g.: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: false # 'false' (default) allows for two concurrent runs, one executing and one freshly enqueued; 'true' for only one; no 'concurrency:' defined for multiple.

jobs:
build:
runs-on: ubuntu-22.04
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
ARCH: i486
RELEASE: 3.4.0.24
steps:

- name: Checkout
uses: actions/checkout@v3

Expand All @@ -28,9 +47,6 @@ jobs:
# key: cache

- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: i486
RELEASE: 3.4.0.24
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -44,7 +60,7 @@ jobs:
- name: Upload build results
uses: actions/upload-artifact@v3
with:
name: RPM-build-results
name: RPM-build-results-${{ env.RELEASE }}-${{ env.ARCH }}
path: output/

# "Create release" does not fit here, because this workflow is triggered by Pull Requests,
Expand All @@ -61,3 +77,9 @@ jobs:
# hub release create"$assets" -m "$tag_name" "$tag_name"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Just for fun, see https://feathericons.com/ and
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#branding
#branding: # "Invalid workflow file: Unexpected value 'branding'"; maybe action MUST be located in '/' or the name MUST be action.yml, see e.g., https://github.com/actions/cache/blob/main/action.yml#L37
# icon: 'gift'
# color: 'purple'
69 changes: 54 additions & 15 deletions .github/workflows/ci-on-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,41 @@ name: CI on tags
on:
push:
tags:
- '*'
# '**' also matches the slash ('/'), in contrast to '*',
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- '**'
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

# See, e.g.: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
env:
# For the latest available docker image, see https://github.com/CODeRUS/docker-sailfishos-platform-sdk
LATEST: 4.5.0.16
# Do not wait up to the default of 10 minutes for network timeouts in a workflow which runs at most 20 minutes
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2

defaults:
run:
# Note thas 'bash' provides -o pipefail, in contrast to the default (i.e., unspecified, which also uses bash) or 'sh',
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: sh

concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: false # 'false' (default) allows for two concurrent runs, one executing and one freshly enqueued; 'true' for only one; no 'concurrency:' defined for multiple.

jobs:
build:
runs-on: ubuntu-22.04
# One job for the latest Docker images used and one for the oldest ones.
# Trying to download three multi-GB, layered docker images in a single job may
# result in "docker: write /var/lib/docker/tmp/GetImageBlobXYZ: no space left on device."

build-on-LATEST:
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
RELEASE: ${{ env.LATEST }}
runs-on: ubuntu-22.04
steps:
- name: Checkout

- name: Checkout git repository
uses: actions/checkout@v3

#- name: Prepare
Expand All @@ -31,8 +54,7 @@ jobs:

- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: aarch64
RELEASE: ${{ env.LATEST }}
ARCH: i486
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -46,7 +68,6 @@ jobs:
- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: armv7hl
RELEASE: ${{ env.LATEST }}
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -59,8 +80,7 @@ jobs:

- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: i486
RELEASE: ${{ env.LATEST }}
ARCH: aarch64
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -71,10 +91,23 @@ jobs:
mb2 -t SailfishOS-$1-$2 build -d
sudo cp -r RPMS/. /share/output/$1/$2/' sh_mb2 $RELEASE $ARCH

- name: Upload build results
uses: actions/upload-artifact@v3
with:
name: RPM-build-results-${{ env.RELEASE }}
path: output/

build-on-OLDEST:
runs-on: ubuntu-22.04
steps:

- name: Checkout git repository
uses: actions/checkout@v3

- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: aarch64
RELEASE: 4.0.1.45
ARCH: i486
RELEASE: 3.4.0.24
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -101,8 +134,8 @@ jobs:

- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
env:
ARCH: i486
RELEASE: 3.4.0.24
ARCH: aarch64
RELEASE: 4.0.1.45
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
Expand All @@ -116,7 +149,7 @@ jobs:
- name: Upload build results
uses: actions/upload-artifact@v3
with:
name: RPM-build-results
name: RPM-build-results-OLDEST
path: output/

# Due to building two releases for each architecture, they will clobber each other,
Expand All @@ -133,3 +166,9 @@ jobs:
# hub release create"$assets" -m "$tag_name" "$tag_name"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Just for fun, see https://feathericons.com/ and
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#branding
#branding: # "Invalid workflow file: Unexpected value 'branding'"; maybe action MUST be located in '/' or the name MUST be action.yml, see e.g., https://github.com/actions/cache/blob/main/action.yml#L37
# icon: 'gift'
# color: 'purple'