From 43df7d5331c788c3bbe9a376547a33045e69d13d Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Fri, 6 Nov 2020 12:57:25 +0700 Subject: [PATCH] Migrate CI from travis-ci.com to GitHub Actions --- .dockerignore | 2 +- .github/workflows/main.yml | 27 +++++++++++++++++++++++++++ .travis.yml | 15 --------------- README.md | 2 +- addons/godot_xterm/native/build.sh | 6 ++++-- addons/godot_xterm/native/shell.nix | 1 + docker-compose.yml | 4 ++-- dockerfiles/archlinux | 13 ++++++++++--- dockerfiles/ubuntu | 14 +++++++++++--- 9 files changed, 57 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.dockerignore b/.dockerignore index b50f0bc..b7c36ec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ addons/godot_xterm/native/external/* -addons/godot_xterm/native/bin/**/* +addons/godot_xterm/native/bin/* addons/godot_xterm/native/.sconsign*.dblite diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..81340a2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build-nixos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build for supported platforms on NixOS + run: docker-compose run build-nixos + build-archlinux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build for supported platforms on Arch Linux + run: docker-compose run build-archlinux + build-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build for supported platforms on Ubuntu + run: docker-compose run build-ubuntu diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6062dd6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: nix - -services: -- docker - -jobs: - include: - - name: "Build native libs on Arch Linux" - env: SERVICE=build-archlinux - - name: "Build native libs on NixOS" - env: SERVICE=build-nixos - - name: "Build native libs on Ubuntu" - env: SERVICE=build-ubuntu - -script: docker-compose run $SERVICE diff --git a/README.md b/README.md index 43bf8ca..a7e2f96 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![Version](https://img.shields.io/badge/version-0.1.0-orange.svg) ![Godot Version](https://img.shields.io/badge/godot-3.2+-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg) -[![Build Status](https://travis-ci.com/lihop/godot-xterm.svg?branch=master)](https://travis-ci.com/lihop/godot-xterm) +[![Build Status](https://github.com/lihop/godot-xterm/workflows/build/badge.svg?branch=master)](https://github.com/lihop/godot-xterm/actions?query=branch%3Amaster) Terminal emulator for Godot using GDNative and [libtsm](https://github.com/Aetf/libtsm). diff --git a/addons/godot_xterm/native/build.sh b/addons/godot_xterm/native/build.sh index f019bac..654a80a 100755 --- a/addons/godot_xterm/native/build.sh +++ b/addons/godot_xterm/native/build.sh @@ -9,7 +9,7 @@ NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" # Run script inside a nix shell if it is available. if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then cd ${NATIVE_DIR} - nix-shell --pure --command "./build.sh $1" + nix-shell --pure --run "NIX_PATH=${NIX_PATH} ./build.sh $1" exit fi @@ -34,7 +34,9 @@ case $1 in # Cross-compile release build for all platforms. scons platform=linux bits=64 target=release -j$(nproc) if [ $IN_NIX_SHELL ]; then - nix-shell --pure --argstr system i686-linux --run 'scons platform=linux bits=32 target=release -j$(nproc)' + nix-shell --pure --argstr system i686-linux --run "NIX_PATH=${NIX_PATH} scons platform=linux bits=32 target=release -j$(nproc)" + else + scons platform=linux bits=32 target=release -j$(nproc) fi scons platform=windows bits=64 target=release -j$(nproc) #scons platform=windows bits=32 target=release -j$(nproc) diff --git a/addons/godot_xterm/native/shell.nix b/addons/godot_xterm/native/shell.nix index ef605ae..9a7b488 100644 --- a/addons/godot_xterm/native/shell.nix +++ b/addons/godot_xterm/native/shell.nix @@ -6,6 +6,7 @@ with (import { mkShell { buildInputs = with pkgs; [ binutils.bintools + cacert cmake git libxkbcommon diff --git a/docker-compose.yml b/docker-compose.yml index 1c387de..d8a7330 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: build: context: . dockerfile: ./dockerfiles/archlinux - command: /src/addons/godot_xterm/native/build.sh + command: /src/addons/godot_xterm/native/build.sh release-all build-nixos: build: context: . @@ -14,4 +14,4 @@ services: build: context: . dockerfile: ./dockerfiles/ubuntu - command: /src/addons/godot_xterm/native/build.sh + command: /src/addons/godot_xterm/native/build.sh release-all diff --git a/dockerfiles/archlinux b/dockerfiles/archlinux index 9b4b559..0f6c457 100644 --- a/dockerfiles/archlinux +++ b/dockerfiles/archlinux @@ -1,7 +1,14 @@ FROM archlinux:20200908 RUN pacman -Sy --needed --noconfirm \ - base-devel \ - cmake \ + # The following are required to compile for any platform: git \ - scons + scons \ + # The following are required to compile for 64-bit Linux: + base-devel \ + # The following are required to compile for 32-bit Linux: + multilib-devel \ + # The following is required to cross-compile for 32/64-bit Windows: + mingw-w64-gcc \ + # The following is required to cross-compile for MacOS: + clang COPY . /src diff --git a/dockerfiles/ubuntu b/dockerfiles/ubuntu index d48b4cd..b74e52c 100644 --- a/dockerfiles/ubuntu +++ b/dockerfiles/ubuntu @@ -1,8 +1,16 @@ FROM ubuntu:18.04 RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ + # The following are required to compile for any platform: git \ python3 \ - scons + scons \ + # The following are required to compile for 64-bit Linux: + build-essential \ + # The following are required to compile for 32-bit Linux: + gcc-multilib \ + g++-multilib \ + # The following is required to cross-compile for 32/64-bit Windows: + g++-mingw-w64-x86-64 \ + # The following is required to cross-compile for MacOS: + clang COPY . /src