Skip to content

Commit

Permalink
Added github actions CI, removed Travis CI files.
Browse files Browse the repository at this point in the history
Packaging a release no longer needs to account for different 'tar' implementations.

Also renamed packaging command from 'box' to 'Package' to be in line with LLVM
packaging naming.

Now only published 2 release packages, one for linux and one for macos.
  • Loading branch information
Emoun committed Nov 15, 2022
1 parent 6f07d41 commit abf8ed4
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 125 deletions.
29 changes: 29 additions & 0 deletions .github/actions/build-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Build Package'
description: 'Builds all binaries and packages them'

runs:
using: "composite"
steps:
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get install libboost-dev libboost-program-options-dev libelf-dev expect
- name: Install dependencies (MacOs)
if: runner.os == 'macOS'
shell: bash
run: |
brew install libelf boost expect
- name: Setup CMake
shell: bash
run: |
mkdir -p build
cd build
cmake .. CMAKE_BUILD_TYPE=Release
- name: Build
working-directory: build
shell: bash
run: make $J Package


72 changes: 72 additions & 0 deletions .github/workflows/simulator-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Simulator CI

on:
push:
branches: '**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-**'
pull_request:
schedule:
# Run every monday at 1:00 AM
- cron: '00 1 * * MON'

env:
CARGO_TERM_COLOR: always
J: -j2

jobs:
test:
name: Test
runs-on: ${{matrix.platform}}
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
cc: gcc
cxx: g++
- platform: ubuntu-20.04
cc: gcc
cxx: g++
- platform: macos-12
cc: clang
cxx: clang++
- platform: macos-11
cc: clang
cxx: clang++
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-package
- name: Test
working-directory: build
shell: bash
run: ctest $J --verbose --output-on-failure
release:
name: Release
runs-on: ${{matrix.platform}}
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-20.04
cc: gcc
cxx: g++
- platform: macos-11
cc: clang
cxx: clang++
# Run after the test jobs finish
needs: [test]
# Run only if this was triggered by a tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-package
- uses: softprops/action-gh-release@v1
with:
files: build/patmos-simulator-*.tar.gz





71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

45 changes: 26 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ if (NOT FOUND_EXPECT)
"See more: https://linux.die.net/man/1/expect")
endif()


include_directories(include ./ ${Boost_INCLUDE_DIRS} ${ELF_INCLUDE_DIRS})

# make sure the boost templates compile
Expand All @@ -96,37 +95,45 @@ add_subdirectory(src)
add_subdirectory(tests)

# Save the target triple in a variable
execute_process( COMMAND gcc -dumpmachine OUTPUT_VARIABLE TARGET_TRIPLE OUTPUT_STRIP_TRAILING_WHITESPACE )
execute_process( COMMAND gcc -dumpmachine OUTPUT_VARIABLE DUMP_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE )
message(WARNING "Machine Triple: ${DUMP_MACHINE}")
if (${DUMP_MACHINE} MATCHES "x86_64-linux-gnu")
set( TARGET_TRIPLE "x86_64-linux-gnu")
elseif(${DUMP_MACHINE} MATCHES "x86_64-apple-darwin.*")
set( TARGET_TRIPLE "x86_64-apple-darwin")
else()
message(FATAL_ERROR "Unsupported platform for packaging")
endif()
set( PROJECT_NAME "patmos-simulator")
set( PACKAGE_TAR "${PROJECT_NAME}-${TARGET_TRIPLE}.tar")
set( PACKAGE_TAR_GZ "${PACKAGE_TAR}.gz")
set( PACKAGE_INFO_FILE "${PROJECT_NAME}-info.yml")
set( PACKAGE_BINARIES "src/pasim" "src/pacheck" "src/paasm" "src/padasm" )
if (APPLE)
# Mac usually has BSD tar
set(TRANSFORM_FLAG "-s")
set(TRANSFORM_STRING "/^src/bin/")
else()
# By default, assume using GNU tar.
set(TRANSFORM_FLAG "--transform")
set(TRANSFORM_STRING "s,^src,bin,")
endif()
add_custom_target(PackageDir
"${CMAKE_COMMAND}" -E make_directory
"bin"
)
set( PACKAGE_BINARIES "bin/pasim" "bin/pacheck" "bin/paasm" "bin/padasm" )

# Build release tarball containing binaries and metadata
add_custom_command(
OUTPUT ${PACKAGE_TAR_GZ}
# We add all generated files to the list of outputs to ensure that cleaning will remove them.
${PACKAGE_TAR} ${PACKAGE_INFO_FILE}
${PACKAGE_TAR} ${PACKAGE_INFO_FILE} ${PACKAGE_BINARIES}

# Copy binaries to bin/ directory, so we don't need to rename their paths using tar
COMMAND cp "src/pasim" "bin/"
COMMAND cp "src/pacheck" "bin/"
COMMAND cp "src/paasm" "bin/"
COMMAND cp "src/padasm" "bin/"

# Package binaries
COMMAND tar -cf ${PACKAGE_TAR}
# Rename "src/*" to "bin/*"
${TRANSFORM_FLAG} ${TRANSFORM_STRING} ${PACKAGE_BINARIES}
COMMAND tar -cf ${PACKAGE_TAR} ${PACKAGE_BINARIES}

# Build YAML info file
COMMAND ${CMAKE_COMMAND} -E echo "name: ${PROJECT_NAME}" > ${PACKAGE_INFO_FILE}
COMMAND ${CMAKE_COMMAND} -E echo "target: ${TARGET_TRIPLE}" >> ${PACKAGE_INFO_FILE}
COMMAND ${CMAKE_COMMAND} -E echo_append "version: " >> ${PACKAGE_INFO_FILE}
COMMAND git describe --tags >> ${PACKAGE_INFO_FILE}
COMMAND git describe --tags --always >> ${PACKAGE_INFO_FILE}
COMMAND ${CMAKE_COMMAND} -E echo_append "commit: " >> ${PACKAGE_INFO_FILE}
COMMAND git rev-parse HEAD >> ${PACKAGE_INFO_FILE}
COMMAND ${CMAKE_COMMAND} -E echo "files:" >> ${PACKAGE_INFO_FILE}
Expand All @@ -138,7 +145,7 @@ add_custom_command(
# Compress the tar
COMMAND gzip -9 < ${PACKAGE_TAR} > ${PACKAGE_TAR_GZ}

DEPENDS ${PACKAGE_BINARIES}
DEPENDS PackageDir "src/pasim" "src/pacheck" "src/paasm" "src/padasm"
)
# Rename release tarball target to something better.
add_custom_target(box DEPENDS ${PACKAGE_TAR_GZ})
add_custom_target(Package DEPENDS ${PACKAGE_TAR_GZ})
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ usage: `pasim <binary stream> <trace output>`

Supported Platforms:

- Ubuntu 16, 18
- Ubuntu 18 or higher
- MacOs

Prebuilt binaries can be found [here](https://github.com/t-crest/patmos-simulator/releases).
Expand Down Expand Up @@ -286,7 +286,7 @@ Requirements:

To package binaries for release, run the following command in the build directory:
```
make -j box
make -j Package
```

It will make a tarball with the name `patmos-simulator-*.tar.gz` (where `*` is the build target)
Expand All @@ -297,7 +297,7 @@ that includes the following:

#### Deployment

Travis-CI manages deploying a new release of these tools to Github Releases.
Github Actions (CI) manages deploying a new release of these tools to Github Releases.

To trigger a release, you simply have to push a tag with the version number of the new release:

Expand Down
15 changes: 0 additions & 15 deletions ci/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions ci/build.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci/test.sh

This file was deleted.

0 comments on commit abf8ed4

Please sign in to comment.