Skip to content

Commit

Permalink
Merge pull request #546 from openmultiplayer/amir/github-cis
Browse files Browse the repository at this point in the history
Move from self hosted runners to github's
  • Loading branch information
AmyrAhmady authored Dec 24, 2022
2 parents 53a7f26 + 53873ff commit 55fe672
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 34 deletions.
108 changes: 78 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
jobs:
build-windows:
name: Windows x86 build
runs-on: [self-hosted, new-runner]
runs-on: windows-2019

steps:
- uses: actions/checkout@v3
Expand All @@ -39,6 +39,19 @@ jobs:
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=0" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v2

Expand All @@ -61,25 +74,28 @@ jobs:
- name: Build
run: |
cd build
cmake --build . --config RelWithDebInfo
cmake --build . --config ${{ steps.vars.outputs.build_config }}
- name: Create a snapshot
- name: Create a build archive
shell: bash
env:
CI_PRIVATE_KEY: ${{ secrets.CI_PRIVATE_KEY }}
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")
archive_name="open.mp-win-snapshot-${version}.zip"
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-win-${version}.zip"
cd build/Output/*
powershell -NoLogo -NoProfile -Command Compress-Archive -DestinationPath "${archive_name}" -Path "Server"
eval $(ssh-agent -s)
echo "${CI_PRIVATE_KEY}" | ssh-add -
echo "put ${archive_name}" | sftp -oStrictHostKeyChecking=accept-new [email protected]:snapshots/
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: open.mp-win-${{ steps.vars.outputs.build_version }}
path: build/Output/${{ steps.vars.outputs.build_config }}/open.mp-win-${{ steps.vars.outputs.build_version }}.zip
if-no-files-found: error

build-linux-static:
name: Linux x86 dynssl build
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand All @@ -89,6 +105,19 @@ jobs:
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=0" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
Expand All @@ -97,24 +126,27 @@ jobs:
- name: Build
run: |
cd docker
CONFIG=RelWithDebInfo UBUNTU_VERSION=18.04 BUILD_SHARED=0 BUILD_SERVER=1 BUILD_TOOLS=0 ./build.sh
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} ./build.sh
- name: Create a snapshot
- name: Create a build archive
env:
CI_PRIVATE_KEY: ${{ secrets.CI_PRIVATE_KEY }}
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")
archive_name="open.mp-linux-static-snapshot-${version}.tar.xz"
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-linux-${version}.tar.xz"
cd docker/build/Output/*
tar -cJvf "${archive_name}" "Server"
eval $(ssh-agent -s)
echo "${CI_PRIVATE_KEY}" | ssh-add -
echo "put ${archive_name}" | sftp -oStrictHostKeyChecking=accept-new [email protected]:snapshots/
sudo tar -cJvf "${archive_name}" "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: open.mp-linux-${{ steps.vars.outputs.build_version }}
path: docker/build/Output/${{ steps.vars.outputs.build_config }}/open.mp-linux-${{ steps.vars.outputs.build_version }}.tar.xz
if-no-files-found: error

build-linux:
name: Linux x86 build
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand All @@ -124,6 +156,19 @@ jobs:
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=1" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
Expand All @@ -132,26 +177,29 @@ jobs:
- name: Build
run: |
cd docker
CONFIG=RelWithDebInfo UBUNTU_VERSION=18.04 BUILD_SHARED=1 BUILD_SERVER=1 BUILD_TOOLS=0 ./build.sh
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} ./build.sh
- name: Create a snapshot
- name: Create a build archive
env:
CI_PRIVATE_KEY: ${{ secrets.CI_PRIVATE_KEY }}
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")
archive_name="open.mp-linux-snapshot-${version}.tar.xz"
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-linux-dynssl-${version}.tar.xz"
cd docker/build/Output/*
tar -cJvf "${archive_name}" "Server"
eval $(ssh-agent -s)
echo "${CI_PRIVATE_KEY}" | ssh-add -
echo "put ${archive_name}" | sftp -oStrictHostKeyChecking=accept-new [email protected]:snapshots/
sudo tar -cJvf "${archive_name}" "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: open.mp-linux-dynssl-${{ steps.vars.outputs.build_version }}
path: docker/build/Output/${{ steps.vars.outputs.build_config }}/open.mp-linux-dynssl-${{ steps.vars.outputs.build_version }}.tar.xz
if-no-files-found: error

abi-check:
if: github.event_name == 'pull_request'
name: SDK ABI check
needs: build-linux
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-latest
strategy:
matrix:
path:
Expand Down
190 changes: 190 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: Build

on:
release:
types:
- created

jobs:
build-windows:
name: Windows x86 build
runs-on: windows-2019

steps:
- uses: actions/checkout@v3
with:
clean: true
ref: stable
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=0" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v2

- name: Install CMake
uses: lukka/[email protected]

- name: Install latest conan
run: |
python -m pip install --upgrade pip
pip install conan
- name: Generate build files
run: |
$env:OMP_BUILD_VERSION=$(git rev-list $(git rev-list --max-parents=0 HEAD) HEAD | Measure-Object -Line).Lines
$env:OMP_BUILD_COMMIT=$(git rev-parse HEAD)
mkdir build
cd build
cmake .. -A Win32 -T "ClangCL"
- name: Build
run: |
cd build
cmake --build . --config ${{ steps.vars.outputs.build_config }}
- name: Create a build archive
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-win-${version}.zip"
cd build/Output/*
powershell -NoLogo -NoProfile -Command Compress-Archive -DestinationPath "${archive_name}" -Path "Server"
- name: Upload to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/Output/${{ steps.vars.outputs.build_config }}/open.mp-win-${{ steps.vars.outputs.build_version }}.zip
asset_name: open.mp-win-${{ steps.vars.outputs.build_version }}.zip
asset_content_type: application/gzip

build-linux-static:
name: Linux x86 dynssl build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
clean: true
ref: stable
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=0" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Build
run: |
cd docker
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} ./build.sh
- name: Create a build archive
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-linux-${version}.tar.xz"
cd docker/build/Output/*
sudo tar -cJvf "${archive_name}" "Server"
- name: Upload to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: docker/build/Output/${{ steps.vars.outputs.build_config }}/open.mp-linux-${{ steps.vars.outputs.build_version }}.tar.xz
asset_name: open.mp-linux-${{ steps.vars.outputs.build_version }}.tar.xz
asset_content_type: application/gzip

build-linux:
name: Linux x86 build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
clean: true
ref: stable
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0

- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=1" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Build
run: |
cd docker
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} ./build.sh
- name: Create a build archive
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
archive_name="open.mp-linux-dynssl-${version}.tar.xz"
cd docker/build/Output/*
sudo tar -cJvf "${archive_name}" "Server"
- name: Upload to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: docker/build/Output/${{ steps.vars.outputs.build_config }}/open.mp-linux-dynssl-${{ steps.vars.outputs.build_version }}.tar.xz
asset_name: open.mp-linux-dynssl-${{ steps.vars.outputs.build_version }}.tar.xz
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.19)
project(open-mp LANGUAGES C CXX VERSION 0.0.10)
project(open-mp LANGUAGES C CXX VERSION 0.0.11)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
Loading

0 comments on commit 55fe672

Please sign in to comment.