-
Notifications
You must be signed in to change notification settings - Fork 17
84 lines (73 loc) · 3.05 KB
/
ci-on-pull_req.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: CI on Pull Request to main branch
on:
pull_request:
branches:
- main
# Allows to run this workflow manually from the Actions tab.
workflow_dispatch:
defaults:
run:
# Note that '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
# Do not use concurrency in order to enforce checking every commit of a Pull Request.
# 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 }}
# 'false' (default) allows for two concurrent runs, one executing and one freshly enqueued; 'true' for only one; no 'concurrency:' defined for multiple.
#cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-22.04
env:
# Do not wait up to the default of 10 minutes for network timeouts in a workflow which runs ca. 4 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
# Solely build for i486 on 4.0.1, because of https://github.com/sailfishos-patches/patchmanager/pull/437#issuecomment-1615317003
ARCH: i486
RELEASE: 4.0.1.45
steps:
- name: Checkout
uses: actions/checkout@v3
#- name: Prepare
# run:
# Caching Docker images is not ready yet, see
# https://github.com/storeman-developers/harbour-storeman-installer/blob/devel/cache-docker-images_github-ci.md
#- name: Cache Docker images of the Sailfish-SDK
# id: cache-sdk
# uses: actions/cache@v3
# with:
# path: $GITHUB_WORKSPACE/…
# key: cache
- name: Build ${{ env.ARCH }} on ${{ env.RELEASE }}
run: |
set -x
mkdir -p output/$RELEASE/$ARCH
docker run --rm -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/sh -xc '
mkdir -p rpmbuild/SOURCES
printf %s "${{ secrets.TOKEN_GITHUB }}" > rpmbuild/SOURCES/token-github.txt
printf %s "${{ secrets.TOKEN_GITLAB }}" > rpmbuild/SOURCES/token-gitlab.txt
mkdir -p build/rpm
cp rpmbuild/SOURCES/token-git??b.txt build/rpm/
cd build
cp -r /share/. .
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_SDK-for-${{ env.RELEASE }}_${{ env.ARCH }}
path: output/
# "Create release" does not fit here, because this workflow is triggered by Pull Requests,
# not newly set Git tags.
# - name: Create release
# if: contains(github.ref, 'release')
# run: |
# set -x
# assets=""
# for asset in output/*/*/*.rpm; do
# assets="$assets -a $asset"
# done
# tag_name="${GITHUB_REF##*/}"
# hub release create"$assets" -m "$tag_name" "$tag_name"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}