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

update action and installer for v1 #176

Merged
merged 41 commits into from
Sep 14, 2023
Merged
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
7 changes: 0 additions & 7 deletions .github/CI_FAILURE_ISSUE_TEMPLATE.md

This file was deleted.

10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
3 changes: 0 additions & 3 deletions .github/smoke-test.sh

This file was deleted.

71 changes: 21 additions & 50 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,22 @@
on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
inputs:
version:
required: true

jobs:
# check if this is a new release
smoke:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.tea.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: ./
id: tea

- id: rev-parse
name: did we already publish this version?
run: |
# fetch tags since actions/checkout is a shallow checkout
git fetch --prune --unshallow --tags

if git show-ref --tags v${{ steps.tea.outputs.version }} --quiet; then
echo "::set-output name=result::cancel"
fi

- uses: andymckay/[email protected]
if: ${{ steps.rev-parse.outputs.result == 'cancel' }}

ci:
needs: [smoke]
qa1:
uses: ./.github/workflows/ci.yml
secrets: inherit

ci-pre-reqs:
needs: [smoke]
uses: ./.github/workflows/ci-pre-reqs.yml
secrets: inherit
qa2:
uses: ./.github/workflows/ci.installer.yml
qa3:
uses: ./.github/workflows/ci.action.yml

put:
permissions:
contents: write
deployments: write
needs: [ci, ci-pre-reqs, smoke]
needs: [qa1, qa2, qa3]
runs-on: ubuntu-latest
steps:
- name: Create Deployment
Expand All @@ -63,30 +34,30 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- run: |
aws s3 cp \
./install.sh s3://www.tea.xyz/pour.sh \
--metadata-directive REPLACE \
- run:
aws s3 cp
./installer.sh s3://www.tea.xyz/pour.sh
--metadata-directive REPLACE
--cache-control no-cache,must-revalidate
- run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
- run:
aws cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths / /pour.sh

- run: |
git tag v${{ needs.smoke.outputs.version }}
git push origin v${{ needs.smoke.outputs.version }}
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}

- uses: softprops/action-gh-release@v1
with:
files: ./install.sh
tag_name: v${{ needs.smoke.outputs.version }}
files: ./installer.sh
tag_name: v${{ github.event.inputs.version }}
fail_on_unmatched_files: true

- uses: fischerscode/tagger@v0
with:
prefix: v
tag: v${{ needs.smoke.outputs.version }}
tag: v${{ github.event.inputs.version }}

- name: Seal Deployment
uses: bobheadxi/deployments@v1
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/ci-pre-reqs.yml

This file was deleted.

100 changes: 100 additions & 0 deletions .github/workflows/ci.action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
on:
workflow_call:
pull_request:
paths:
- action.ts
- action.yml
- package.json

concurrency:
group: ${{ github.ref || 'ci' }}/action.ts
cancel-in-progress: true

jobs:
check-dist-was-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: curl -Ssf https://tea.xyz/$(uname)/$(uname -m).tgz | sudo tar xz -C /usr/local/bin
- run: ./scripts/dist.sh
- run: git diff --exit-code

gha:
needs: check-dist-was-run
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- [self-hosted, macOS, ARM64] # we need to be sure the action
- [self-hosted, linux, ARM64] # works in arm64 environments
prefix:
- null
- /opt
container:
- null
include:
- os: ubuntu-latest
container: debian:buster-slim
srcroot: .
- os: ubuntu-latest
container: debian:buster-slim
srcroot: null
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3

- uses: ./
id: tea
with:
prefix: ${{ matrix.prefix }}
srcroot: ${{ matrix.srcroot || github.workspace }}

- run: test -n "$VERSION"
- run: test -n "${{ steps.tea.outputs.version }}"
- run: test v$VERSION = v${{ steps.tea.outputs.version }}
- run: tea --env
- run: which tea
- run: node --eval 'console.log(1)'

chaste:
needs: check-dist-was-run
runs-on: ubuntu-latest
container: debian:buster-slim
steps:
- uses: actions/checkout@v3
- uses: ./
with:
chaste: true
- run:
if node --version; then
exit 1;
fi

additional-pkgs:
needs: check-dist-was-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
+deno.land: ^1.30
# ^^ produces a warning, but we like this syntax
# we're hoping GH allows us to suppress this warning in the future
# discussion: https://github.com/octokit/request-action/issues/26
- run: deno --version

additional-pkgs-2:
needs: check-dist-was-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
+: |
deno.land^1.30
cli.github.com
- run: deno --version
- run: gh --version
111 changes: 111 additions & 0 deletions .github/workflows/ci.installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
on:
workflow_call:
pull_request:
paths:
- installer.sh
- .github/workflows/ci.installer.yml

concurrency:
group: ${{ github.ref || 'ci' }}/installer.sh
cancel-in-progress: true

permissions:
contents: read

jobs:
install-tea:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
steps:
- uses: actions/checkout@v3
# using cat | sh to emulate the curl command we tell people to use
- run: cat ./installer.sh | sh
- run: tea --version

usage-as-proxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cat ./installer.sh | sh -s node --eval 'console.log(1)'
- run: ./installer.sh sh -c "which tea"
- run: source <(cat ./installer.sh) duf
- run: if command -v tea; then exit 1; fi

sudo-not-required:
runs-on: ubuntu-latest
container: debian:buster-slim
steps:
- uses: actions/checkout@v3
- run: ./installer.sh
env:
PATH: ${{ github.workspace }}/bin:/usr/bin:/bin

eval-bash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
eval "$(cat ./installer.sh)"
tea +duf
duf --version

test -n "$BASH_VERSION"
test -z "$ZSH_VERSION"
shell: bash -e {0}

# check tea was installed despite executing via `eval`
- run:
tea duf --version

eval-zsh:
runs-on: ubuntu-latest
steps:
- name: prep
run: sudo apt-get update && sudo apt-get install -y zsh

- uses: actions/checkout@v3
- run: |
eval "$(cat ./installer.sh)"
tea +duf
duf --version

test -n "$ZSH_VERSION"
test -z "$BASH_VERSION"
shell: zsh -e {0}

eval-posix-sh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
eval "$(cat ./installer.sh)"
tea +duf
duf --version

test -z "$ZSH_VERSION"
test -z "$BASH_VERSION"
shell: /bin/sh -e {0}

sudo-required:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo chmod go-w /usr/local/bin
# ^^ we run as `runner` but this dir has 999 perms
- run: ./installer.sh
- run: test "$(which tea)" = /usr/local/bin/tea

no-dirs:
strategy:
matrix:
dir: [/usr/local, /usr/local/bin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo mv ${{ matrix.dir }} $(mktemp -d)
- run: ./installer.sh
- run: tea duf --version
Loading