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

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

Merged
merged 40 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
919d109
chore: version dev tools
jthegedus May 25, 2021
fd842ad
ci: extract linting to own worflow
jthegedus May 25, 2021
b13588b
ci: used asdf in tests. use wsl on windows runner
jthegedus May 25, 2021
b640d2f
ci: merge macos ubuntu test job into nix job
jthegedus May 25, 2021
b5e7b7c
ci: wsl distros
jthegedus May 25, 2021
108f200
chore: remove unused Vagrantfile
jthegedus May 25, 2021
89847d4
fix: workflow badge links
jthegedus May 25, 2021
e5c8567
test: older bats version
jthegedus May 25, 2021
fcf6982
fix: WSL action does not support WSLv1 on OS windows-2016
jthegedus May 25, 2021
d77372b
ci: do not use asdf in tests
jthegedus May 25, 2021
1593a1a
fix: workflow format
jthegedus May 25, 2021
bf4ed38
ci: try expression syntax for wsl-bash interpolation
jthegedus May 25, 2021
dda7f50
test: use expression for GITHUB_PATH in WSL
jthegedus May 25, 2021
6724197
test: use expression for GITHUB_PATH in WSL
jthegedus May 25, 2021
2a23db9
test: original append to github path
jthegedus May 25, 2021
8f884d8
ci: only run on Ubuntu WSL
jthegedus May 25, 2021
2138182
ci: install bats on WSL using install script
jthegedus May 25, 2021
f1120db
ci: wsl direct exec of bats, no path appending
jthegedus May 25, 2021
5f25b59
ci: unix line endings when performing checkout
jthegedus May 25, 2021
9e9c3f7
ci: perform asdf checkout in wsl
jthegedus May 25, 2021
2f46b19
fix: workflow default env vars
jthegedus May 25, 2021
07fb690
ci: test github workflow default env vars
jthegedus May 25, 2021
04be768
ci: github env vars in wsl workflow
jthegedus May 25, 2021
9dd3efe
ci: github env vars in wsl workflow
jthegedus May 25, 2021
5e1c969
ci: rename lint jobs
jthegedus May 25, 2021
17e6dbe
ci: github env vars in wsl workflow
jthegedus May 25, 2021
8fb8c23
fix: typo
jthegedus May 25, 2021
1563979
ci: try default env format again
jthegedus May 25, 2021
b684c4d
ci: try without run step sequence
jthegedus May 25, 2021
b33559a
ci: use github workspace instead of default env vars
jthegedus May 25, 2021
b9499c8
ci: fix wsl shell cmd
jthegedus May 25, 2021
c60842a
ci: fix wsl shell cmd
jthegedus May 25, 2021
7a56d0c
ci: fix typo
jthegedus May 25, 2021
29eaae2
ci: clone asdf to specific empty dir
jthegedus May 25, 2021
1aa1840
ci: do not fail on wsl1
jthegedus May 25, 2021
0896fe4
chore: rename lint workflow step
jthegedus May 25, 2021
d3270fb
ci: wsl bats exec location in default dir
jthegedus May 25, 2021
7645f69
ci: wsl green check when tests fail
jthegedus May 25, 2021
bcbd1a2
ci: rm workflow execution filter
jthegedus May 25, 2021
b47d586
ci: remove continue-on-error for wsl1 job
jthegedus May 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 95 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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:
Copy link
Member

Choose a reason for hiding this comment

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

Why is this job named nix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the job that runs our Bats tests on the *nix OSs. * is invalid in the job name when I tried naming it *nix. Didn't think the job name was particularly important.

The other job is called WSL1 because though it is a Windows OS, the environment we want to test in is different distros on WSL1 environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can rename the job to whatever, I just thought this was the most descriptive at the time.

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 }}
88 changes: 0 additions & 88 deletions .github/workflows/workflow.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bats v1.3.0
shellcheck 0.7.2
shfmt 3.3.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand Down
71 changes: 0 additions & 71 deletions Vagrantfile

This file was deleted.

8 changes: 0 additions & 8 deletions lint.sh

This file was deleted.

29 changes: 10 additions & 19 deletions release/README.md
Original file line number Diff line number Diff line change
@@ -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`
jthegedus marked this conversation as resolved.
Show resolved Hide resolved
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