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

👷 Refactor ➾ (ci) move tests to self-hosted Mac Minis #1509

Merged
merged 11 commits into from
Nov 18, 2022
95 changes: 29 additions & 66 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ concurrency:
group: ${{ github.ref_name || github.ref }}
cancel-in-progress: true

env:
TAQ_VERSION: ${{ github.ref_name }}

jobs:
# When we use reusable we lose the ability to to filter out the workflow for changes to certain paths.
# This job creates boolean outputs based on path filters. These outputs can then be used as job conditions
Expand Down Expand Up @@ -48,25 +51,6 @@ jobs:
id: get-version
uses: battila7/get-version-action@v2

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: "1.23.4"

- name: Build all
run: |
export PATH="$PATH:$(pwd)"
npx lerna bootstrap
npm run build:packages
npm run build:binary
npm run build:docker

- name: cache node modules
uses: actions/cache@v3
with:
path: ./node_modules/**
key: cache-node-modules-${{ github.run_id }}

build-binaries:
name: Build Taqueria binaries
permissions:
Expand Down Expand Up @@ -116,7 +100,6 @@ jobs:
id: build-bin
shell: bash
env:
TAQ_VERSION: ${{ github.ref_name }}
DENO_DIR: "./deno"
run: |
BUILD=`git rev-parse --short "$GITHUB_SHA"`
Expand Down Expand Up @@ -192,25 +175,19 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, ecad-macmini]
chunk-ids: ${{ fromJson(needs.gather-info-for-e2e-tests.outputs['test-chunk-ids']) }}
include:
- os: ubuntu-latest
url: ${{ needs.build-binaries.outputs.public-url-ubuntu }}
final-name: taq
make-executable-cmd: chmod +x
get-current-dir: echo "$(pwd)"
cache_path: |
~/.deno
~/.cache/deno
- os: macos-latest
- os: ecad-macmini
url: ${{ needs.build-binaries.outputs.public-url-macos }}
final-name: taq
make-executable-cmd: chmod +x
get-current-dir: echo "$(pwd)"
cache_path: |
~/.deno
~/Library/Caches/deno

env:
UNLIMITED_PINATA_TOKEN: ${{ secrets.PINATA_JWT_TOKEN }}
Expand All @@ -219,7 +196,7 @@ jobs:
needs:
- build-binaries
- gather-info-for-e2e-tests
if: ${{ always() && !(contains(needs.*.result, 'failure')) && github.event_name != 'release' && !(startsWith(github.ref, 'refs/tags/v')) }}
if: ${{ github.event_name != 'release' && !(startsWith(github.ref, 'refs/tags/v')) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -231,48 +208,23 @@ jobs:
with:
deno-version: "1.23.4"

- name: setup-docker
if: runner.os == 'macOS'
run: |
brew install docker
brew install colima
colima start
- name: Add working dir to PATH
run: echo "$(pwd)" >> $GITHUB_PATH

- name: Cache node modules
uses: actions/cache@v3
with:
path: ./node_modules/**
key: cache-node-modules-${{ github.run_id }}

- name: download the binary from the build-binaries job and make it executable
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
curl --url ${{ matrix.url }} -o ${{ matrix.final-name }} -L
${{ matrix.make-executable-cmd }} ${{ matrix.final-name }}
${{ matrix.get-current-dir }} >> $GITHUB_PATH

- name: build binary and make executable
if: ${{ github.event.pull_request.head.repo.fork }}
env:
TAQ_VERSION: ${{ github.ref_name }}
DENO_DIR: "./deno"
- name: Build all
run: |
COMMIT=`git rev-parse --short "$GITHUB_SHA"`
BUILD=`git rev-parse --short "$GITHUB_SHA"`
TAQ_VERSION="${TAQ_VERSION/\//-}"
deno compile --output taq --target $DENO_TARGET --allow-run --allow-write --allow-read --allow-env --allow-net index.ts --setBuild "$COMMIT" --setVersion "$TAQ_VERSION" --lock ./deno-lock.json
[[ $(./taq init -p ./test_project) == "Project taq'ified!" ]]
chmod +x taq
echo "$(pwd)" >> $GITHUB_PATH

- name: Build docker image
run: npm run build-docker --workspaces --if-present
npx lerna bootstrap
npm run build:packages
deno compile --output taq --allow-run --allow-write --allow-read --allow-env --allow-net --import-map ./import_map.json --no-prompt index.ts --setBuild "$BUILD" --setVersion "$TAQ_VERSION" --lock ./deno-lock.json
npm run build:docker

- name: Run unit tests
run: npm run test:unit -w tests

- name: Run integration tests
run: npm run test:integration -w tests

- name: Run e2e tests
run: npm run test:e2e -w tests ${{ fromJSON(env.CHUNKS)[matrix.chunk-ids] }}
env:
Expand Down Expand Up @@ -315,11 +267,22 @@ jobs:
node-version: lts/gallium
cache: "npm"

- name: Cache node modules
uses: actions/cache@v3
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
path: ./node_modules/**
key: cache-node-modules-${{ github.run_id }}
deno-version: "1.23.4"

- name: Add working dir to PATH
run: echo "$(pwd)" >> $GITHUB_PATH

- name: Build all
run: |
BUILD=`git rev-parse --short "$GITHUB_SHA"`
TAQ_VERSION="${TAQ_VERSION/\//-}"
npx lerna bootstrap
npm run build:packages
deno compile --output taq --allow-run --allow-write --allow-read --allow-env --allow-net --import-map ./import_map.json --no-prompt index.ts --quickstart "`cat quickstart.md`" --setBuild "$BUILD" --setVersion "$TAQ_VERSION" --lock ./deno-lock.json
npm run build:docker

- name: Publish for PR
if: ${{ github.event_name == 'pull_request' }}
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ jobs:
- name: Attempt to rebuild
run: npm rebuild | true

- name: Cache node modules
uses: actions/cache@v3
with:
path: ./node_modules/**
key: cache-node-modules-${{ github.run_id }}
- name: Add working dir to PATH
run: echo "$(pwd)" >> $GITHUB_PATH

- name: Build all
run: |
npx lerna bootstrap
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding --force-local to ensure local packages are linked

npm run build:packages

- name: Compile TS
run: npm run compile:test --workspace ${{ env.GIT_WORKSPACE }}
Expand Down Expand Up @@ -102,6 +104,7 @@ jobs:

publish-marketplace:
name: Publish VSCode Extension
if: ${{ github.event_name != 'pull_request' }}
needs:
- test-build
runs-on: ubuntu-latest
Expand All @@ -112,12 +115,6 @@ jobs:
with:
node-version: lts/gallium
cache: "npm"

- name: Cache node modules
uses: actions/cache@v3
with:
path: ./node_modules/**
key: cache-node-modules-${{ github.run_id }}

- name: Compile TS
run: npm run compile --workspace ${{ env.GIT_WORKSPACE }}
Expand Down
2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test:unit:deno:with-coverage": "TEST=true deno test unit/ --allow-all --unstable --coverage=coverage_report && deno coverage coverage_report && deno coverage coverage_report --lcov > coverage_profile.lcov",
"test:unit:selected": "TEST=true deno test unit/taqueria-utils/taqueria-utils.test.ts --allow-all --unstable --coverage=coverage_report && deno coverage coverage_report",
"test:integration": "TEST=true jest --config jest.config.integration.ts --no-cache",
"test:e2e": "TEST=true jest --config jest.config.e2e.ts --maxWorkers=1"
"test:e2e": "TEST=true jest --config jest.config.e2e.ts"
},
"repository": {
"type": "git",
Expand Down