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

Try to install on many OS using Travis and docker. #61

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/basictestrun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
43 changes: 40 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
dist: trusty
sudo: required

matrix:
include:
- os: linux
- env: OS_TYPE=fedora
- env: INSTALL_REQUIREMENTS="dnf repolist; dnf install -y perl shellcheck devscripts sudo wget"

- os: linux
- env: OS_TYPE=opensuse
- env: INSTALL_REQUIREMENTS="zypper refresh; zypper in -y perl shellcheck devscripts sugo wget"

- os: linux
- env: OS_TYPE=dauchida/freebsd
- env: INSTALL_REQUIREMENTS="pkg install -y perl shellcheck devscripts sudo wget"

- os: linux
- env: OS_TYPE=debian:11
- env: INSTALL_REQUIREMENTS="sudo apt-get update -qq; sudo apt-get upgrade -y; sudo apt-get install -y -qq perl shellcheck devscripts sudo wget"

- os: linux
- env: OS_TYPE=ubuntu:22.04
- env: INSTALL_REQUIREMENTS="sudo apt-get update -qq; sudo apt-get upgrade -y; sudo apt-get install -y -qq perl shellcheck devscripts sudo wget"

- os: osx
- env: OS_TYPE=osx
- env: INSTALL_REQUIREMENTS="brew update; brew install perl shellcheck devscripts sudo wget"

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq perl shellcheck devscripts
script: prove
- [[ $TRAVIS_OS_NAME == "linux" ]] && docker pull ${OS_TYPE}

install:
- [[ $TRAVIS_OS_NAME == "osx" ]] && docker run -d $OS /bin/sh -c "$INSTALL_REQUIREMENTS"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which value will be set for $OS variable?
If it is a linux distribution name (such as ubuntu:22.04), we don't need to run onosx env, which cost more credits than usual.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And, there is absolutely 100% no way I'm ever going to support MacOS. I spent weeks messing about with it several years ago, and it's not worth it (and the days of MacOS on a server are over, if they ever existed...they didn't really, but Apple did used to make servers). Besides that, the best "package manager" on MacOS is allegedly Homebrew, which is a disaster, especially for servers.

- [[ $TRAVIS_OS_NAME == "linux" ]] && docker run -d $OS /bin/sh -c "$INSTALL_REQUIREMENTS"
- docker run -d $OS /bin/sh -c "sudo wget https://github.com/EspaceNetworks/virtualmin-install/raw/master/virtualmin-install.sh"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not hard code to your repository.
Are we able to use checked out file in source directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Have to look up the runtime variable in travis for "the URL to a file in the current checked out source we're running this test on" so that it'd work right from everywhere.

- docker run -d $OS /bin/sh -c "sudo chmod +x virtualmin-install.sh"

script:
# Test for osx and run different build or prep commands:
- [[ $TRAVIS_OS_NAME == "osx" ]] && docker run -d $OS /bin/sh -c "prove" && docker run -d $OS /bin/sh -c "./virtualmin-install.sh"
- [[ $TRAVIS_OS_NAME == "linux" ]] && docker run -d $OS /bin/sh -c "prove"&& docker run -d $OS /bin/sh -c "./virtualmin-install.sh"