Skip to content

Commit 8150438

Browse files
committed
Added Windows to GitHub Actions
1 parent 6ae3fce commit 8150438

File tree

10 files changed

+318
-81
lines changed

10 files changed

+318
-81
lines changed

.github/workflows/appimage.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
description: 'The output of the complete_version of the "determine_version" job from the build_and_release.yml workflow'
99
required: true
1010
type: string
11-
release_upload_url:
11+
release_id:
1212
description: 'The output of the "create_release" job from the build_and_release.yml workflow'
1313
required: true
1414
type: string
@@ -42,7 +42,7 @@ jobs:
4242
sed -i s/@@VERSION@@/${PACKAGE_VERSION}/ AppImageBuilder.yml
4343
mkdir build
4444
cd build
45-
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_WEBSERVER=ON -DENABLE_WEBCAM=ON -DPERFORMOUS_VERSION=$PACKAGE_VERSION ..
45+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCOMPOSER_VERSION=$PACKAGE_VERSION ..
4646
make -j$(nproc) install DESTDIR=../AppDir
4747
cd ..
4848
appimage-builder --recipe AppImageBuilder.yml --skip-test
@@ -70,11 +70,9 @@ jobs:
7070
- name: Upload artifacts to tagged release
7171
id: upload_assets
7272
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
73-
uses: actions/upload-release-asset@v1
73+
uses: xresloader/upload-to-github-release@v1
7474
env:
7575
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7676
with:
77-
upload_url: ${{ inputs.release_upload_url }}
78-
asset_path: ${{ env.ARTIFACT_PATH }}
79-
asset_name: ${{ env.ARTIFACT_NAME }}
80-
asset_content_type: application/octet-stream
77+
release_id: ${{ inputs.release_id }}
78+
file: ${{ env.ARTIFACT_PATH }}

.github/workflows/build_and_release.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ jobs:
3838
version_tweak: ${{ steps.versioning.outputs.version_tweak }}
3939
complete_version: ${{ steps.versioning.outputs.complete_version }}
4040
steps:
41+
- name: Checkout Composer
42+
uses: actions/checkout@v3
43+
with:
44+
path: ${{ github.workspace }}/performous
45+
repository: ${{ github.event.repository.full_name }}
46+
ref: '${{ github.event.head.ref }}'
47+
fetch-depth: 0
4148
- name: Determine the complete version
4249
id: versioning
4350
run: |
4451
# Always check the tags on master since it will have the latest.
4552
# Tags will trigger their own workflow and version names
46-
git clone --recursive ${{ github.server_url }}/${{ github.repository }} performous_composer
47-
cd performous_composer
53+
cd composer
4854
LATEST_TAG_VERSION=$(git describe --tags --abbrev=0 || echo 1.0.0)
4955
LATEST_FULL_TAG_VERSION=$(git describe --tags || echo 1.0.0)
5056
echo "latest_tag_version=$(git describe --tags --abbrev=0 || echo 1.0.0)" >> $GITHUB_OUTPUT
@@ -53,7 +59,7 @@ jobs:
5359
echo "version_minor=$(cut -d '.' -f 2 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT
5460
echo "version_patch=$(cut -d '.' -f 3 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT
5561
echo "version_tweak=0" >> $GITHUB_OUTPUT
56-
echo "complete_version=$(if [ $GITHUB_REF_TYPE = 'tag' ]; then echo $GITHUB_REF_NAME; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME = 'master' ]; then echo $LATEST_FULL_TAG_VERSION-beta; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME != 'master' ]; then echo $LATEST_TAG_VERSION-${{github.event.pull_request.number}}-${GITHUB_SHA::7}-alpha; fi)" >> $GITHUB_OUTPUT
62+
echo "complete_version=$(if [ $GITHUB_REF_TYPE = 'tag' ]; then echo $GITHUB_REF_NAME; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME = 'master' ]; then echo $LATEST_FULL_TAG_VERSION-beta; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME != 'master' ]; then echo $LATEST_TAG_VERSION-${{github.event.pull_request.number}}-$(git rev-parse --short=7 $(git describe))-alpha; fi)" >> $GITHUB_OUTPUT
5763
5864
# Set up a release that packages will be published to.
5965
create_release:
@@ -62,17 +68,15 @@ jobs:
6268
# Make sure the output variable for this step is set so it
6369
# can be consumed by later build steps
6470
outputs:
65-
upload_url: ${{ steps.create_release.outputs.upload_url }}
71+
release_id: ${{ steps.create_release.outputs.id }}
6672
steps:
6773
- name: Create the Main release
6874
id: create_release
6975
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
70-
uses: actions/create-release@v1
71-
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
uses: softprops/action-gh-release@v1
7377
with:
7478
tag_name: ${{ github.ref_name }}
75-
release_name: Composer ${{ github.ref_name }}
79+
name: Performous ${{ github.ref_name }}
7680
draft: true
7781
prerelease: false
7882

@@ -82,18 +86,18 @@ jobs:
8286
uses: ./.github/workflows/linux.yml
8387
with:
8488
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
85-
release_upload_url: ${{ needs.create_release.outputs.upload_url }}
89+
release_id: ${{ needs.create_release.outputs.release_id }}
8690
needs:
8791
- determine_version
8892
- create_release
8993

9094
# Pull in the AppImage build workflow
9195
AppImage_Package:
92-
name: Build the AppImage
96+
name: Build the AppImage package
9397
uses: ./.github/workflows/appimage.yml
9498
with:
9599
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
96-
release_upload_url: ${{ needs.create_release.outputs.upload_url }}
100+
release_id: ${{ needs.create_release.outputs.release_id }}
97101
needs:
98102
- determine_version
99103
- create_release
@@ -110,12 +114,12 @@ jobs:
110114
# - create_release
111115

112116
# Pull in the Windows build workflow
113-
#Windows_Packages:
114-
# name: Build the Windows packages
115-
# uses: ./.github/workflows/windows.yml
116-
# with:
117-
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
118-
# release_upload_url: ${{ needs.create_release.outputs.upload_url }}
119-
# needs:
120-
# - determine_version
121-
# - create_release
117+
Windows_Packages:
118+
name: Build the Windows packages
119+
uses: ./.github/workflows/windows.yml
120+
with:
121+
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
122+
release_id: ${{ needs.create_release.outputs.release_id }}
123+
needs:
124+
- determine_version
125+
- create_release

.github/workflows/build_functions.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,31 @@
2626
## The fourth argument is the OS name, and the fifth
2727
## argument is the OS version, both are optional.
2828
function package_name () {
29-
WORK_DIR=${1}
30-
PACKAGE_REGEX=${2}
31-
PACKAGE_OFFICIAL_VERSION=${3}
32-
PACKAGE_OS=${4}
33-
PACKAGE_OS_VERSION=${5}
29+
WORK_DIR=${1}
30+
PACKAGE_REGEX=${2}
31+
PACKAGE_OFFICIAL_VERSION=${3}
32+
PACKAGE_OS=${4}
33+
PACKAGE_OS_VERSION=${5}
3434

35-
if [ ${PACKAGE_OS} ]; then
36-
PACKAGE_OS_NAME="-${PACKAGE_OS}"
37-
fi
38-
if [ ${PACKAGE_OS_VERSION} ]; then
39-
PACKAGE_OS_VERSION_NAME="_${PACKAGE_OS_VERSION}"
40-
fi
41-
PACKAGE_PATH=$(ls ${WORK_DIR}/${PACKAGE_REGEX})
42-
PACKAGE_NAME=$(basename ${PACKAGE_PATH})
43-
PACKAGE_SUFFIX=$(echo ${PACKAGE_NAME} | rev | cut -d'.' -f1 | rev)
44-
NEW_PACKAGE_NAME="Composer-${PACKAGE_OFFICIAL_VERSION}${PACKAGE_OS_NAME}${PACKAGE_OS_VERSION_NAME}.${PACKAGE_SUFFIX}"
45-
NEW_PACKAGE_PATH="/tmp/${NEW_PACKAGE_NAME}"
46-
MASTER_NEW_PACKAGE_NAME="Composer-latest${PACKAGE_OS_NAME}${PACKAGE_OS_VERSION_NAME}.${PACKAGE_SUFFIX}"
47-
MASTER_NEW_PACKAGE_PATH="/tmp/${MASTER_NEW_PACKAGE_NAME}"
48-
cp ${PACKAGE_PATH} ${MASTER_NEW_PACKAGE_PATH}
49-
cp ${PACKAGE_PATH} ${NEW_PACKAGE_PATH}
50-
ARTIFACT_NAME=$(basename ${NEW_PACKAGE_NAME})
51-
MASTER_ARTIFACT_NAME=$(basename ${MASTER_NEW_PACKAGE_NAME})
52-
echo "ARTIFACT_PATH=${NEW_PACKAGE_PATH}" >> ${GITHUB_ENV}
53-
echo "ARTIFACT_NAME=${NEW_PACKAGE_NAME}" >> ${GITHUB_ENV}
54-
echo "MASTER_ARTIFACT_PATH=${MASTER_NEW_PACKAGE_PATH}" >> ${GITHUB_ENV}
55-
echo "MASTER_ARTIFACT_NAME=${MASTER_NEW_PACKAGE_NAME}" >> ${GITHUB_ENV}
35+
if [[ "${PACKAGE_OS}" != "" ]]; then
36+
PACKAGE_OS_NAME="-${PACKAGE_OS}"
37+
fi
38+
if [[ "${PACKAGE_OS_VERSION}" != "" ]]; then
39+
PACKAGE_OS_VERSION_NAME="_${PACKAGE_OS_VERSION}"
40+
fi
41+
PACKAGE_PATH=$(ls ${WORK_DIR}/${PACKAGE_REGEX})
42+
PACKAGE_NAME=$(basename ${PACKAGE_PATH})
43+
PACKAGE_SUFFIX=$(echo ${PACKAGE_NAME} | rev | cut -d'.' -f1 | rev)
44+
NEW_PACKAGE_NAME="Performous-${PACKAGE_OFFICIAL_VERSION}${PACKAGE_OS_NAME}${PACKAGE_OS_VERSION_NAME}.${PACKAGE_SUFFIX}"
45+
NEW_PACKAGE_PATH="/tmp/${NEW_PACKAGE_NAME}"
46+
MASTER_NEW_PACKAGE_NAME="Performous-latest${PACKAGE_OS_NAME}${PACKAGE_OS_VERSION_NAME}.${PACKAGE_SUFFIX}"
47+
MASTER_NEW_PACKAGE_PATH="/tmp/${MASTER_NEW_PACKAGE_NAME}"
48+
cp ${PACKAGE_PATH} ${MASTER_NEW_PACKAGE_PATH}
49+
cp ${PACKAGE_PATH} ${NEW_PACKAGE_PATH}
50+
ARTIFACT_NAME=$(basename ${NEW_PACKAGE_NAME})
51+
MASTER_ARTIFACT_NAME=$(basename ${MASTER_NEW_PACKAGE_NAME})
52+
echo "ARTIFACT_PATH=${NEW_PACKAGE_PATH}" >> ${GITHUB_ENV}
53+
echo "ARTIFACT_NAME=${NEW_PACKAGE_NAME}" >> ${GITHUB_ENV}
54+
echo "MASTER_ARTIFACT_PATH=${MASTER_NEW_PACKAGE_PATH}" >> ${GITHUB_ENV}
55+
echo "MASTER_ARTIFACT_NAME=${MASTER_NEW_PACKAGE_NAME}" >> ${GITHUB_ENV}
5656
}

.github/workflows/comment_on_pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Get the PR number
17+
id: get_pr
1718
run: |
1819
# Query the issue search API to get the PR associated with it
1920
PR_RAW=$(curl 'https://api.github.com/search/issues?q=${{ github.event.workflow_run.head_commit.id }}')
2021
# Get the event number from the search results, which will
2122
# be the PR number
2223
PR_NUM=$(echo $PR_RAW | jq '.items[].number')
23-
echo "PR_NUM=${PR_NUM}" >> ${GITHUB_ENV}
24+
echo "PR_NUM=${PR_NUM}" >> $GITHUB_OUTPUT
2425
2526
- name: Comment on PR
2627
uses: actions/github-script@v5
@@ -61,5 +62,5 @@ jobs:
6162
}
6263
body += ` \n\nThis service is provided by [nightly.link](https://github.com/oprypin/nightly.link). These artifacts will expire in 90 days and will not be available for download after that time.`;
6364
core.info("Review thread message body:", body);
64-
await upsertComment(owner, repo, ${{ env.PR_NUM }},
65+
await upsertComment(owner, repo, ${{ steps.get_pr.outputs.PR_NUM }},
6566
"nightly-link", body);

.github/workflows/linux.yml

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
description: 'The output of the complete_version of the "determine_version" job from the build_and_release.yml workflow'
99
required: true
1010
type: string
11-
release_upload_url:
11+
release_id:
1212
description: 'The output of the "create_release" job from the build_and_release.yml workflow'
1313
required: true
1414
type: string
@@ -19,35 +19,73 @@ env:
1919

2020
jobs:
2121
# Decide if we need to build the containers on this run
22-
determine_docker_build:
22+
determine_docker_version:
2323
name: Determine whether to build the containers or not
2424
runs-on: ubuntu-latest
2525
outputs:
26-
build_docker_containers: ${{ steps.docker_check.outputs.build_docker_containers }}
26+
build_docker_containers: ${{ steps.version.outputs.build_docker_containers }}
27+
build_debian_containers: ${{ steps.version.outputs.build_debian_containers }}
28+
build_ubuntu_containers: ${{ steps.version.outputs.build_ubuntu_containers }}
29+
build_fedora_containers: ${{ steps.version.outputs.build_fedora_containers }}
2730
steps:
2831
- name: Checkout
2932
id: checkout
3033
uses: actions/checkout@v3
3134
with:
3235
fetch-depth: 0
3336

34-
- name: Build docker check
35-
id: docker_check
37+
- name: Determine version
38+
id: version
3639
run: |
3740
# Only run the container builds when something in the docker folder or
3841
# this workflow has changed from master, or if it was cron triggered
39-
GIT_OUTPUT="$(git log -n 2 --stat)"
40-
if [ $(echo ${GIT_OUTPUT} | grep -c docker/) -gt 0 ] || [ $(echo ${GIT_OUTPUT} | grep -c .github/workflows/linux.yml) -gt 0 ] || [ '${{ github.event_name }}' = 'schedule' ]; then
42+
if [[ '${{ github.event_name }}' == 'push' ]]; then
43+
base_version='${{ github.event.before }}'
44+
else
45+
base_version='origin/master'
46+
fi
47+
DIFF_YML=$((git rev-parse HEAD:.github/workflows/linux.yml && git diff --merge-base ${base_version} --exit-code -- .github/workflows/linux.yml) > /dev/null 2>&1 ; echo $?)
48+
if [[ $DIFF_YML != 0 || '${{ github.event_name }}' == 'schedule' ]]; then
49+
echo "Refresh all containers: TRUE"
4150
echo "build_docker_containers=true" >> $GITHUB_OUTPUT
4251
else
52+
echo "Refresh all containers: FALSE"
4353
echo "build_docker_containers=false" >> $GITHUB_OUTPUT
4454
fi
4555
56+
DIFF_UBUNTU=$((git rev-parse HEAD:docker/Dockerfile.ubuntu HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.ubuntu docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
57+
DIFF_DEBIAN=$((git rev-parse HEAD:docker/Dockerfile.debian HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.debian docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
58+
DIFF_FEDORA=$((git rev-parse HEAD:docker/Dockerfile.fedora HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.fedora docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
59+
60+
if [[ $DIFF_UBUNTU != 0 ]]; then
61+
echo "Refresh Ubuntu containers: TRUE"
62+
echo "build_ubuntu_containers=true" >> $GITHUB_OUTPUT
63+
else
64+
echo "Refresh Ubuntu containers: FALSE"
65+
echo "build_ubuntu_containers=false" >> $GITHUB_OUTPUT
66+
fi
67+
68+
if [[ $DIFF_FEDORA != 0 ]]; then
69+
echo "Refresh FEDORA containers: TRUE"
70+
echo "build_fedora_containers=true" >> $GITHUB_OUTPUT
71+
else
72+
echo "Refresh FEDORA containers: FALSE"
73+
echo "build_fedora_containers=false" >> $GITHUB_OUTPUT
74+
fi
75+
76+
if [[ $DIFF_DEBIAN != 0 ]]; then
77+
echo "Refresh DEBIAN containers: TRUE"
78+
echo "build_debian_containers=true" >> $GITHUB_OUTPUT
79+
else
80+
echo "Refresh DEBIAN containers: FALSE"
81+
echo "build_debian_containers=false" >> $GITHUB_OUTPUT
82+
fi
83+
4684
build_packages:
4785
name: Build the Linux packages
4886
runs-on: ubuntu-latest
4987
needs:
50-
- determine_docker_build
88+
- determine_docker_version
5189
strategy:
5290
matrix:
5391
include:
@@ -59,6 +97,8 @@ jobs:
5997
version: 10
6098
- os: debian
6199
version: 11
100+
- os: debian
101+
version: 12
62102
- os: fedora
63103
version: 35
64104
## FFMPEG5 causes issues
@@ -75,7 +115,7 @@ jobs:
75115
- name: Container name
76116
run: |
77117
# Figure out the container name we'll use for the build
78-
BUILD_CONTAINER=${{ env.REGISTRY }}/${{ env.REPO_NAME }}/composer-deps:${{ matrix.os }}-${{ matrix.version }}
118+
BUILD_CONTAINER=${{ env.REGISTRY }}/${{ env.REPO_NAME }}/deps:${{ matrix.os }}-${{ matrix.version }}
79119
echo "CONTAINER_NAME=${BUILD_CONTAINER}" >> $GITHUB_ENV
80120
81121
- name: Checkout
@@ -89,7 +129,7 @@ jobs:
89129
password: ${{ secrets.GITHUB_TOKEN }}
90130

91131
- name: Build ${{ matrix.os }} ${{ matrix.version }} Container
92-
if: ${{ needs.determine_docker_build.outputs.build_docker_containers == 'true' }}
132+
if: needs.determine_docker_version.outputs[format('build_{0}_containers', matrix.os)] == 'true' || needs.determine_docker_version.outputs['build_docker_containers'] == 'true'
93133
uses: docker/build-push-action@v3
94134
with:
95135
context: docker/
@@ -106,25 +146,19 @@ jobs:
106146
# Set the correct version in cmake
107147
PACKAGE_VERSION=${{ inputs.package_complete_version }}
108148
EXTRA_CMAKE_ARGS="-DCOMPOSER_VERSION=${PACKAGE_VERSION}"
109-
110-
# Decide if we should build a 'Release' package or a 'RelWithDebInfo' (default)
111-
# For some reason, building with 'RelWithDebInfo' (default) doesn't work
112-
# specifically on PRs, so we'll just build Releases for everything for now
113-
#if [ '${{ github.event_name }}' != 'pull_request' ]; then
114-
RELEASE_TYPE="-R"
115-
#fi
149+
COMPOSER_RELEASE_TYPE="RelWithDebInfo"
116150
117151
# Only pull the container if it wasn't built locally
118-
if [ '${{ needs.determine_docker_build.outputs.build_docker_containers }}' = 'false' ]; then
152+
if [ '${{ needs.determine_docker_version.outputs.build_docker_containers }}' = 'false' ]; then
119153
docker pull ${{ env.CONTAINER_NAME }}
120154
fi
121155
122156
# Run the build inside the docker containers using the
123157
# build script that was pulled inside during the build
124-
docker run --rm -v $(pwd):/github_actions_build/ ${{ env.CONTAINER_NAME }} ./build_composer.sh -g -D /github_actions_build/ -E ${EXTRA_CMAKE_ARGS} ${RELEASE_TYPE}
158+
docker run --env EXTRA_CMAKE_ARGS --rm -v $(pwd):/github_actions_build/ ${{ env.CONTAINER_NAME }} ./build_composer.sh -g -D /github_actions_build/ -E ${EXTRA_CMAKE_ARGS} -R ${COMPOSER_RELEASE_TYPE}
125159
126160
## Provided by the common build functions
127-
package_name "$(pwd)/build" "Composer*64.*" "${PACKAGE_VERSION}" "${{ matrix.os }}" "${{ matrix.version }}"
161+
package_name "$(pwd)/build" "Composer*Linux.*" "${PACKAGE_VERSION}" "${{ matrix.os }}" "${{ matrix.version }}"
128162
129163
#- name: Run unit tests
130164
# run: |
@@ -151,20 +185,18 @@ jobs:
151185
- name: Upload artifacts to tagged release
152186
id: upload_assets
153187
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
154-
uses: actions/upload-release-asset@v1
188+
uses: xresloader/upload-to-github-release@v1
155189
env:
156190
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157191
with:
158-
upload_url: ${{ inputs.release_upload_url }}
159-
asset_path: ${{ env.ARTIFACT_PATH }}
160-
asset_name: ${{ env.ARTIFACT_NAME }}
161-
asset_content_type: application/octet-stream
192+
release_id: ${{ inputs.release_id }}
193+
file: ${{ env.ARTIFACT_PATH }}
162194

163195
- name: Push container
164196
uses: docker/build-push-action@v3
165197
# Containers can't be pushed during PRs because of the way permissions
166198
# are delegated to secrets.GITHUB_TOKEN
167-
if: ${{ needs.determine_docker_build.outputs.build_docker_containers == 'true' && github.event_name != 'pull_request' }}
199+
if: ${{ needs.determine_docker_version.outputs.build_docker_containers == 'true' && github.event_name != 'pull_request' }}
168200
with:
169201
context: docker/
170202
file: ./docker/Dockerfile.${{ matrix.os }}

0 commit comments

Comments
 (0)