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

Create Autoamted Release Flow #1125

Merged
merged 2 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 132 additions & 132 deletions .github/workflows/retdec-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,141 +3,141 @@
name: RetDec CI

on:
push:
branches:
- master # Activate CI on push on master.
- 'test-*' # Activate CI on branch with prefix test-.
push:
branches:
- master # Activate CI on push on master.
- 'test-*' # Activate CI on branch with prefix test-.

pull_request:
branches:
- master # Activate on pull request.
branches:
- master # Activate on pull request.

env:
# Universal ENV variable containing path to all workflows scripts.
# Each OS has it's own directory there: Windows, macOS, Linux.
# Names of directories are compatible with the $RUNNER_OS variable.
WORKFLOWS_DIR: ${{ github.workspace }}/.github/workflows/
# Universal ENV variable containing path to all workflows scripts.
# Each OS has it's own directory there: Windows, macOS, Linux.
# Names of directories are compatible with the $RUNNER_OS variable.
WORKFLOWS_DIR: ${{ github.workspace }}/.github/workflows/

jobs:
ci-runner:
strategy:
matrix:
sys:
- { os: ubuntu-latest, shell: bash }
- { os: windows-2019, shell: 'msys2 {0}' }
- { os: macos-11, shell: bash }
type: [Release, Debug]

# Let other builds finish.
fail-fast: false

name: ${{ matrix.sys.os }} (${{ matrix.type }})

runs-on: ${{ matrix.sys.os }}

defaults:
run:
shell: ${{ matrix.sys.shell }}

steps:
# Checkouts the correct commit/branch.
- uses: actions/checkout@v3

# We want to use msys2 bash on Windows.
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'

# Installs dependencies on all systems.
- name: Install Dependencies
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/install-deps.sh"
shell: bash

- name: Windows Additional Packages
if: runner.os == 'Windows'
run: |
pacman -S mingw-w64-i686-gcc --noconfirm
pacman -S mingw-w64-x86_64-gcc --noconfirm
pacman -S mingw-w64-x86_64-python --noconfirm
pacman -S python3-pip --noconfirm

# Regression tests framework requires specific version of clang.
# The following script(s) prepares clang on each platform.
- name: Prepare Clang
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/prepare-clang.sh"
env:
# Clang will be available in build/clang
CLANG_DIR_OUT: clang
shell: bash

- name: Build RetDec
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/build.sh"
env:
BUILD_TYPE: ${{ matrix.type }}
shell: bash

- name: Prepare RetDec Regression Tests & Framework
run: bash "${WORKFLOWS_DIR}/common/prepare-retdec-tests.sh"
shell: bash

- name: Run Tests
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/run-tests.sh" "${WORKFLOWS_DIR}/${RUNNER_OS}/ignore_${{ matrix.type }}"

# Prepare files for publishing/release. The resulting structure:
# RetDec-OSType-Release
# |_ bin
# |_ include
# |_ lib
# |_ share
# | \__ retdec/support/
# |
# |_ CHANGELOG.md
# |_ LICENSE
# |_ LICENSE-THIRD-PARTY
# \_ README.md
- name: Prepare Files for Publishing
if: matrix.type == 'Release'
run: |
cp LICENSE* install/
cp CHANGELOG.md install/
cp README.md install/

- name: Archive Artifacts
if: matrix.type == 'Release'
uses: actions/upload-artifact@v1
with:
name: RetDec-${{ runner.os }}-Release
path: install

docs-build:
name: doxygen-build (Linux)
runs-on: ubuntu-18.04

steps:
# Checkouts the correct commit/branch.
- uses: actions/checkout@v3

# Installs dependencies on all systems.
- name: Install Dependencies
run: bash "${WORKFLOWS_DIR}/Linux/install-deps.sh"
shell: bash

- name: Build Docs
run: |
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=install -DRETDEC_DOC=ON
make doc -j$(nproc)

- name: Test Docs
run: |
file="build/doc/doxygen/doxygen.log"
echo "checking file: $file"
content="$(cat $file)"
if [ "$content" = "" ]; then
echo "===> ok"
else
echo "===> fail:"
echo "=========================================="
echo "$content"
echo "=========================================="
exit 1
fi
ci-runner:
strategy:
matrix:
sys:
- { os: ubuntu-latest, shell: bash }
- { os: windows-2019, shell: 'msys2 {0}' }
- { os: macos-11, shell: bash }
type: [Release, Debug]

# Let other builds finish.
fail-fast: false

name: ${{ matrix.sys.os }} (${{ matrix.type }})

runs-on: ${{ matrix.sys.os }}

defaults:
run:
shell: ${{ matrix.sys.shell }}

steps:
# Checkouts the correct commit/branch.
- uses: actions/checkout@v3

# We want to use msys2 bash on Windows.
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'

# Installs dependencies on all systems.
- name: Install Dependencies
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/install-deps.sh"
shell: bash

- name: Windows Additional Packages
if: runner.os == 'Windows'
run: |
pacman -S mingw-w64-i686-gcc --noconfirm
pacman -S mingw-w64-x86_64-gcc --noconfirm
pacman -S mingw-w64-x86_64-python --noconfirm
pacman -S python3-pip --noconfirm

# Regression tests framework requires specific version of clang.
# The following script(s) prepares clang on each platform.
- name: Prepare Clang
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/prepare-clang.sh"
env:
# Clang will be available in build/clang
CLANG_DIR_OUT: clang
shell: bash

- name: Build RetDec
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/build.sh"
env:
BUILD_TYPE: ${{ matrix.type }}
shell: bash

- name: Prepare RetDec Regression Tests & Framework
run: bash "${WORKFLOWS_DIR}/common/prepare-retdec-tests.sh"
shell: bash

- name: Run Tests
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/run-tests.sh" "${WORKFLOWS_DIR}/${RUNNER_OS}/ignore_${{ matrix.type }}"

# Prepare files for publishing/release. The resulting structure:
# RetDec-OSType-Release
# |_ bin
# |_ include
# |_ lib
# |_ share
# | \__ retdec/support/
# |
# |_ CHANGELOG.md
# |_ LICENSE
# |_ LICENSE-THIRD-PARTY
# \_ README.md
- name: Prepare Files for Publishing
if: matrix.type == 'Release'
run: |
cp LICENSE* install/
cp CHANGELOG.md install/
cp README.md install/

- name: Archive Artifacts
if: matrix.type == 'Release'
uses: actions/upload-artifact@v1
with:
name: RetDec-${{ runner.os }}-Release
path: install

docs-build:
name: doxygen-build (Linux)
runs-on: ubuntu-18.04

steps:
# Checkouts the correct commit/branch.
- uses: actions/checkout@v3

# Installs dependencies on all systems.
- name: Install Dependencies
run: bash "${WORKFLOWS_DIR}/Linux/install-deps.sh"
shell: bash

- name: Build Docs
run: |
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=install -DRETDEC_DOC=ON
make doc -j$(nproc)

- name: Test Docs
run: |
file="build/doc/doxygen/doxygen.log"
echo "checking file: $file"
content="$(cat $file)"
if [ "$content" = "" ]; then
echo "===> ok"
else
echo "===> fail:"
echo "=========================================="
echo "$content"
echo "=========================================="
exit 1
fi
119 changes: 119 additions & 0 deletions .github/workflows/retdec-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Automatic Release flow.

name: RetDec Release

on:
push:
# Trigger anytime a release tag is created.
tags:
- "v*"

env:
# Universal ENV variable containing path to all workflows scripts.
# Each OS has it's own directory there: Windows, macOS, Linux.
# Names of directories are compatible with the $RUNNER_OS variable.
WORKFLOWS_DIR: ${{ github.workspace }}/.github/workflows/

jobs:
builder:
strategy:
matrix:
sys:
- { os: ubuntu-latest, shell: bash }
- { os: windows-2019, shell: bash }
- { os: macos-11, shell: bash }

# Fail if one instance fails.
fail-fast: true

name: Build RetDec (${{ matrix.sys.os }})

runs-on: ${{ matrix.sys.os }}

defaults:
run:
shell: ${{ matrix.sys.shell }}

steps:
# Checkouts the correct commit/branch.
- uses: actions/checkout@v3

# Installs dependencies on all systems.
- name: Install Dependencies
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/install-deps.sh"
shell: bash

- name: Build RetDec
run: bash "${WORKFLOWS_DIR}/${RUNNER_OS}/build.sh"
env:
BUILD_TYPE: Release
RETDEC_MSVC_STATIC_RUNTIME: True
shell: bash

# Prepare files for publishing/release. The resulting structure:
# RetDec-OSType-Release
# |_ bin
# |_ include
# |_ lib
# |_ share
# | \__ retdec/support/
# |
# |_ CHANGELOG.md
# |_ LICENSE
# |_ LICENSE-THIRD-PARTY
# \_ README.md
- name: Prepare Files for Publishing
run: |
cp LICENSE* install/
cp SECURITY.md install/
cp CHANGELOG.md install/
cp README.md install/

- name: Pack Artifacts Compactly
if: runner.os != 'Windows'
run: |
tar -cvJf RetDec-${{ github.ref_name }}-${{ runner.os }}-Release.tar.xz *
mv *.tar.xz ..
working-directory: install

- name: Pack Artifacts Compactly on Windows
if: runner.os == 'Windows'
run: |
7z a RetDec-${{ github.ref_name }}-${{ runner.os }}-Release.7z *
mv *.7z ..
shell: bash
working-directory: install

- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: RetDec-${{ github.ref_name }}-${{ runner.os }}-Release
path: RetDec-*

release:
name: Release RetDec

runs-on: ubuntu-latest
needs: builder

steps:
- uses: actions/checkout@v3

# Fetch artifacts from the build step.
- name: Fetch Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

# Create a release.
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
files: |
LICENSE*
CHANGELOG.md
artifacts/*/*.tar.xz
artifacts/*/*.7z