ci: adopt asdf for internal dev. init WSL test environments (#956)

This commit is contained in:
James Hegedus 2021-05-26 22:55:54 +10:00 committed by GitHub
parent 3237167338
commit 5b49e0cb37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 154 additions and 187 deletions

45
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Lint
on:
push:
branches:
- master
pull_request:
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install asdf dependencies
uses: asdf-vm/actions/install@v1
- name: Run ShellCheck
run: |
shellcheck -s bash -x \
asdf.sh \
release/tag.sh \
bin/asdf \
bin/private/asdf-exec \
lib/utils.bash \
lib/commands/*.bash \
completions/*.bash \
test/test_helpers.bash \
test/fixtures/dummy_plugin/bin/*
shellfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install asdf dependencies
uses: asdf-vm/actions/install@v1
- name: List file to shfmt
run: shfmt -f .
- name: Run shfmt
run: shfmt -d .

95
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,95 @@
name: Tests
on:
push:
branches:
- master
pull_request:
env:
BATS_VERSION: v1.3.0
jobs:
wsl1:
strategy:
fail-fast: false
matrix:
os:
- windows-2019
distribution:
- Ubuntu-20.04
- Ubuntu-18.04
# - Alpine
# - Debian
# - kali-linux
# - openSUSE-Leap-15.2
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup WSL & install test dependencies
uses: Vampire/setup-wsl@v1
with:
distribution: ${{ matrix.distribution }}
additional-packages: curl git fish
- name: Install bats
shell: wsl-bash {0}
run: |
git clone --depth 1 --branch "${{ env.BATS_VERSION }}" https://github.com/bats-core/bats-core.git $HOME/bats-core
cd $HOME/bats-core
./install.sh $HOME
$HOME/bin/bats --version
- name: Run tests
shell: wsl-bash {0}
run: |
$HOME/bin/bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}
nix:
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
# - macos-11 - enable once out of private preview: https://github.com/actions/virtual-environments#available-environments
- ubuntu-18.04
- ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install test dependencies
if: runner.os == 'macos'
run: brew install coreutils fish
- name: Install test dependencies
if: runner.os == 'linux'
run: |
PPA="ppa:fish-shell/nightly-master"
sudo add-apt-repository -y "$PPA"
sudo apt-get update
sudo apt-get -y install fish
- name: Install bats
run: |
git clone --depth 1 --branch "${{ env.BATS_VERSION }}" https://github.com/bats-core/bats-core.git $HOME/bats-core
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
- name: Run tests
run: bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}

View File

@ -1,88 +0,0 @@
name: Main workflow
on:
push:
branches:
- master
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: brew install coreutils fish
- name: Install dependencies on Ubuntu
if: runner.os == 'Linux'
run: |
PPA="ppa:fish-shell/nightly-master"
sudo add-apt-repository -y "$PPA"
sudo apt-get update
sudo apt-get -y install fish
- name: Install bats-core
run: |
git clone --depth 1 --branch v1.2.1 https://github.com/bats-core/bats-core.git $HOME/bats-core
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
- name: Run tests on Windows
if: runner.os == 'Windows'
continue-on-error: true
run: bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}
- name: Run tests on Unix systems
if: runner.os != 'Windows'
run: bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install shellcheck
run: sudo apt-get install shellcheck
- name: Run ShellCheck
run: bash lint.sh
format:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install shfmt
run: brew install shfmt
- name: List file to shfmt
run: shfmt -f .
- name: Run shfmt
run: shfmt -d .

3
.tool-versions Normal file
View File

@ -0,0 +1,3 @@
bats v1.3.0
shellcheck 0.7.2
shfmt 3.3.0

View File

@ -1,4 +1,4 @@
# asdf [![Main workflow](https://github.com/asdf-vm/asdf/workflows/Main%20workflow/badge.svg)](https://github.com/asdf-vm/asdf/actions)
# asdf [![Lint](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/lint.yml) [![Tests](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml/badge.svg)](https://github.com/asdf-vm/asdf/actions/workflows/tests.yml)
**Manage multiple runtime versions with a single CLI tool, extendable via plugins** - [docs at asdf-vm.com](https://asdf-vm.github.io/asdf/)

71
Vagrantfile vendored
View File

@ -1,71 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
exec shellcheck -s bash -x \
asdf.sh lint.sh release/tag.sh \
bin/asdf bin/private/asdf-exec \
lib/utils.bash lib/commands/*.bash \
completions/*.bash \
test/test_helpers.bash \
test/fixtures/dummy_plugin/bin/*

View File

@ -1,28 +1,19 @@
# Release README
If you are a user you can ignore everything in this directory. This directory
contains documentation and scripts for preparing and tagging new versions of
asdf and is only used by asdf maintainers.
If you are a user you can ignore everything in this directory. This directory contains documentation and scripts for preparing and tagging new versions of asdf and is only used by asdf maintainers.
## Tagging Release Candidates
To tag release candidates
1. Update the CHANGELOG. Make sure it contains an entry for the version you are
tagging as well as a dev version things that come after the tag (e.g. a heading
with the format `<next-version>-dev`).
2. Run the tests and the linter - `bats test` and `lint.sh`.
3. Run the release script. The new version must be in the format `0.0.0-rc0`.
For example: `release/tag.sh 0.0.0-rc0`.
4. If the release script succeeds, push to GitHub. Make sure to use the correct
remote to push to the official repository
1. Update the CHANGELOG. Make sure it contains an entry for the version you are tagging as well as a dev version things that come after the tag (e.g. a heading with the format `<next-version>-dev`)
2. Run the tests and the linter - `bats test`
3. Run the release script. The new version must be in the format `0.0.0-rc0`. For example: `release/tag.sh 0.0.0-rc0`
4. If the release script succeeds, push to GitHub. Make sure to use the correct remote to push to the official repository
## Tagging Releases
1. Update the CHANGELOG. Make sure it contains an entry for the version you are
tagging as well as a dev version things that come after the tag (e.g. a heading
with the format `<next-version>-dev`).
2. Run the tests and the linter - `bats test` and `lint.sh`.
3. Run the release script. The new version must be in the format `0.0.0`. For
example: `release/tag.sh 0.0.0`.
4. If the release script succeeds, push to GitHub. Make sure to use the correct
remote to push to the official repository
1. Update the CHANGELOG. Make sure it contains an entry for the version you are tagging as well as a dev version things that come after the tag (e.g. a heading with the format `<next-version>-dev`)
2. Run the tests and the linter - `bats test`
3. Run the release script. The new version must be in the format `0.0.0`. For example: `release/tag.sh 0.0.0`
4. If the release script succeeds, push to GitHub. Make sure to use the correct remote to push to the official repository