Skip to content

Commit

Permalink
Change Python project to Cask
Browse files Browse the repository at this point in the history
  • Loading branch information
conao3 committed Nov 23, 2019
1 parent 79be578 commit beaea21
Show file tree
Hide file tree
Showing 15 changed files with 1,601 additions and 5,710 deletions.
18 changes: 0 additions & 18 deletions .github/python.json

This file was deleted.

35 changes: 19 additions & 16 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: Main workflow
on: [push]

jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
test:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
cask_version:
- '0.8.0'
- '0.8.4'
- 'snapshot'
steps:
- name: Checkout
uses: actions/checkout@master

- name: Set Node.js 10.x
uses: actions/setup-node@master
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
version: 10.x
node-version: 10.x

- name: npm install
run: npm install
- uses: purcell/setup-emacs@master
with:
version: 26.3

- name: Lint
run: npm run format-check
- run: npm install
- run: npm run format-check
- run: npm test

- name: npm test
run: npm test
- uses: ./
with:
version: ${{ matrix.cask_version }}
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License (MIT)

Copyright (c) 2018 GitHub, Inc. and contributors
Copyright (c) 2019 Naoya Yamashita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
55 changes: 0 additions & 55 deletions README.md

This file was deleted.

131 changes: 131 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#+author: conao
#+date: <2019-11-23 Sat>

[[https://github.com/conao3/setup-cask][https://raw.githubusercontent.com/conao3/files/master/blob/headers/png/feather.el.png]]
[[https://github.com/conao3/setup-cask/blob/master/LICENSE][https://img.shields.io/github/license/conao3/setup-cask.svg?style=flat-square]]
[[https://github.com/conao3/setup-cask/releases][https://img.shields.io/github/tag/conao3/setup-cask.svg?style=flat-square]]
[[https://github.com/conao3/setup-cask/actions][https://github.com/conao3/setup-cask/workflows/Main%20workflow/badge.svg]]
[[https://app.codacy.com/project/conao3/setup-cask/dashboard][https://img.shields.io/codacy/grade/1108333059ce4bc7a833a42a4eaf417c.svg?logo=codacy&style=flat-square]]
[[https://www.patreon.com/conao3][https://img.shields.io/badge/patreon-become%20a%20patron-orange.svg?logo=patreon&style=flat-square]]
[[https://twitter.com/conao_3][https://img.shields.io/badge/twitter-@conao__3-blue.svg?logo=twitter&style=flat-square]]
[[https://join.slack.com/t/conao3-support/shared_invite/enQtNjUzMDMxODcyMjE1LTA4ZGRmOWYwZWE3NmE5NTkyZjk3M2JhYzU2ZmRkMzdiMDdlYTQ0ODMyM2ExOGY0OTkzMzZiMTNmZjJjY2I5NTM][https://img.shields.io/badge/chat-on_slack-blue.svg?logo=slack&style=flat-square]]

* Table of Contents
- [[#description][Description]]
- [[#usage][Usage]]
- [[#information][Information]]
- [[#donation][Donation]]
- [[#community][Community]]
- [[#contribution][Contribution]]
- [[#license][License]]
- [[#author][Author]]
- [[#contributors][Contributors]]

* Description
~setup-cask~ prepare Cask for your workflow.
- Fetch specified Cask in your workflow ~$HOME~ (such as ~/home/runner/.cask~).
- Add ~/home/runner/.cask/bin~ to your workflow ~$PATH~
- Initiarize Cask

* Usage
~Cask~ depends ~Python~ and ~Emacs~.
You should setup these, respectively, before use ~setup-cask~.

This mechanism has a merit to be able to use specified version of ~Python~ and ~Emacs~.

** Basic
#+begin_src yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
with:
python-version: '3.6'
architecture: 'x64'
- uses: purcell/setup-emacs@master
with:
version: '26.3'

- uses: conao3/setup-cask@master
with:
version: 'snapshot'

- name: Run tests
run: make test
#+end_src

This example is testing your package in below environment.
- Emacs: ~26.3~
- Python: ~3.6~
- Cask: ~snapshot~ (HEAD)

** Matrix testing
#+begin_src yaml
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
emacs_version:
- '26.1'
- '26.2'
- '26.3'
- 'snapshot'
cask_version:
- '0.8.0'
- '0.8.4'
- 'snapshot'
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
with:
python-version: '3.6'
architecture: 'x64'
- uses: purcell/setup-emacs@master
with:
version: '26.3'

- uses: conao3/setup-cask@master
with:
version: 'snapshot'

- name: Run tests
run: make test
#+end_src

This example is testing your package in below environment.
- Emacs: ~26.1~, ~26.2~, ~26.3~
- Python: ~3.6~
- Cask: ~0.8.0~, ~0.8.4~, ~snapshot~ (HEAD)

* Information
** Donation
I love OSS and I am dreaming of working on it as *full-time* job.

*With your support*, I will be able to spend more time at OSS!

[[https://www.patreon.com/conao3][https://c5.patreon.com/external/logo/become_a_patron_button.png]]

** Community
All feedback and suggestions are welcome!

You can use github issues, but you can also use [[https://join.slack.com/t/conao3-support/shared_invite/enQtNjUzMDMxODcyMjE1LTA4ZGRmOWYwZWE3NmE5NTkyZjk3M2JhYzU2ZmRkMzdiMDdlYTQ0ODMyM2ExOGY0OTkzMzZiMTNmZjJjY2I5NTM][Slack]]
if you want a more casual conversation.

** Contribution
Feel free to send PR!

** License
#+begin_example
MIT
Copyright (c) Naoya Yamashita - https://conao3.com
https://github.com/conao3/setup-cask/blob/master/LICENSE
#+end_example

** Author
- Naoya Yamashita ([[https://github.com/conao3][conao3]])

** Contributors
- Not yet... Now send PR and add your name!!
59 changes: 5 additions & 54 deletions __tests__/finder.test.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,9 @@
import io = require('@actions/io');
import fs = require('fs');
import path = require('path');
// finder.test.ts

const toolDir = path.join(
__dirname,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
'tools'
);
const tempDir = path.join(
__dirname,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
'temp'
);
const assert = require('assert');

process.env['RUNNER_TOOL_CACHE'] = toolDir;
process.env['RUNNER_TEMP'] = tempDir;

import * as finder from '../src/find-python';

describe('Finder tests', () => {
it('Finds Python if it is installed', async () => {
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
await io.mkdirP(pythonDir);
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
// This will throw if it doesn't find it in the cache (because no such version exists)
await finder.findPythonVersion('3.x', 'x64');
});

it('Errors if Python is not installed', async () => {
// This will throw if it doesn't find it in the cache (because no such version exists)
let thrown = false;
try {
await finder.findPythonVersion('3.300000', 'x64');
} catch {
thrown = true;
}
expect(thrown).toBeTruthy();
});

it('Finds PyPy if it is installed', async () => {
const pythonDir: string = path.join(toolDir, 'PyPy', '2.0.0', 'x64');
await io.mkdirP(pythonDir);
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
// This will throw if it doesn't find it in the cache (because no such version exists)
await finder.findPythonVersion('pypy2', 'x64');
describe('SyncTest', function() {
it('Equality', function() {
assert.equal(1 + 1, 2);
});
});
19 changes: 9 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: 'Setup Python'
description: 'Set up a specific version of Python and add the command-line tools to the PATH'
author: 'GitHub'
name: 'Setup Cask'
description: 'Install a specific Cask version for use in your workflow.'
author: 'Naoya Yamashita'
inputs:
python-version:
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
default: '3.x'
architecture:
description: 'The target architecture (x86, x64) of the Python interpreter.'
default: 'x64'
version:
description: 'The version of Emacs to install, e.g. "0.8.4", or "snapshot" for a recent development version.'
default: 'snapshot'

runs:
using: 'node12'
main: 'dist/index.js'

branding:
icon: 'code'
color: 'yellow'
color: 'yellow'
Loading

0 comments on commit beaea21

Please sign in to comment.