-
-
Notifications
You must be signed in to change notification settings - Fork 8
103 lines (82 loc) · 3.1 KB
/
manual_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# .github/workflows/manual_build.yml
name: "Manual Build and test Workflow"
on: [workflow_dispatch]
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
name: ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9' # New PIP is buggy, error "has different metadata"
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.4.6'
no-color: true # --noColor
- name: Get Git Commit Short Hash
id: vars
shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "semver_date=$(date +'%y.%m.%d')" >> $GITHUB_ENV
- name: Set Environment Variables
uses: allenevans/[email protected]
with:
NIM_VERSION: "1.4.6"
MAIN_MODULE: "faster_than_csv/faster_than_csv.nim"
PACKAGE_NAME: "faster_than_csv"
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_NON_INTERACTIVE: 1
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Nimble Install dependencies
run: |
nimble -y refresh
nimble -y install nimpy
pip install nimporter
- uses: juancarlospaco/nimpretty-action@main
with:
folders: "faster_than_requests"
# - name: Generate Documentation (Linux)
# if: runner.os == 'Linux'
# run: |
# nim doc --out:docs/index.html ${{ env.MAIN_MODULE }}
# nim rst2tex --out:docs/${{ env.PACKAGE_NAME }}.tex ${{ env.MAIN_MODULE }}
- name: Compile Debug & import (Linux)
if: runner.os == 'Linux'
run: |
nim c --app:lib --threads:on --out:$PACKAGE_NAME.so $MAIN_MODULE
python3 -c "print(__import__('${{ env.PACKAGE_NAME }}').__file__)"
- name: Compile Debug & import (Windows)
if: runner.os == 'Windows'
run: |
nim c --app:lib --threads:on --out:$PACKAGE_NAME.so $MAIN_MODULE
python.exe -c "print(__import__('${{ env.PACKAGE_NAME }}').__file__)"
- name: Compile Debug & import (MacOs)
if: runner.os == 'macos'
run: |
choosenim -y 1.2.12
nim c --app:lib --threads:on --out:$PACKAGE_NAME.so $MAIN_MODULE
python3 -c "print('${{ env.PACKAGE_NAME }}')"
python3 -c "print(__import__('${{ env.PACKAGE_NAME }}').__file__)"
# - name: Package
# run: python setup.py sdist --format=zip
- name: Commit Nimpretty Fixes # Commit everything to Git repo
uses: EndBug/add-and-commit@v4 # https://github.com/EndBug/add-and-commit/issues/67#issuecomment-711081492
with:
add: 'faster_than_csv/*.nim'
force: true
message: ${{ steps.vars.outputs.semver_date }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Nim
uses: actions/cache@v1
with:
path: $PWD/Nim/
key: ${{ runner.os }}-nim