From 9fd84ff079a82aaca970a07d870561a2e1d68582 Mon Sep 17 00:00:00 2001 From: James Murty Date: Tue, 28 Apr 2020 10:00:56 +1000 Subject: [PATCH] Run tests in GitHub Actions instead of Travis CI Replace Travis CI configuration and run trigger file with an equivalent GitHub Actions workflow to run bats-core units tests on pushes to pull requests targeting master, or pushes to master itself. Currently limited to running on Ubuntu 16.04 to avoid OpenSSL warning mesages from later versions (see #55) from breaking the (too fragile) tests. --- .github/workflows/run-bats-core-tests.yml | 35 +++++++++++++++++++++++ .travis.yml | 10 ------- README.md | 2 ++ 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/run-bats-core-tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/run-bats-core-tests.yml b/.github/workflows/run-bats-core-tests.yml new file mode 100644 index 0000000..907e517 --- /dev/null +++ b/.github/workflows/run-bats-core-tests.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + # Only run tests on push to master branch + push: + branches: [master] + # Run tests for all pull request changes targeting master + pull_request: + branches: [master] + +jobs: + test: + # We use older Ubuntu for now to avoid warning from newer OpenSSL (#55) + # which break output expectations in some (fragile) tests + runs-on: ubuntu-16.04 + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Install and set up bats-core + run: | + git clone https://github.com/bats-core/bats-core.git /tmp/bats-core-repo + mkdir -p /tmp/bats-core + bash /tmp/bats-core-repo/install.sh /tmp/bats-core + + # Need to configure git globally to avoid errors when we create and use + # temporary test-specific Git repos fatal: `empty ident name` + - name: Configure dummy Git user.[name,email] values + run: | + git config --global user.name github-actions-user + git config --global user.email github-actions-user@example.com + + - name: Run tests + run: /tmp/bats-core/bin/bats tests/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f00a189..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: bash - -before_script: - - git clone https://github.com/bats-core/bats-core.git /tmp/bats-core-repo - - mkdir -p /tmp/bats-core - - bash /tmp/bats-core-repo/install.sh /tmp/bats-core - - export PATH=$PATH:/tmp/bats-core/bin - -script: - - bats tests/ diff --git a/README.md b/README.md index b4c3f75..ff81f80 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ to work normally on your local working copy. You can conveniently store things like passwords and private keys within your repository and not have to share them with your entire team or complicate your workflow. +![Tests](https://github.com/elasticdog/transcrypt/workflows/Tests/badge.svg) + ## Overview transcrypt is in the same vein as existing projects like