Skip to content

Commit

Permalink
fix: CI and releases (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dni authored Mar 5, 2025
1 parent eef1cb1 commit b3319a3
Show file tree
Hide file tree
Showing 10 changed files with 1,126 additions and 796 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI
on:
push:
branches:
- main
pull_request:

jobs:
lint:
uses: lnbits/lnbits/.github/workflows/lint.yml@dev
tests:
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v4
- uses: lnbits/lnbits/.github/actions/prepare@dev
with:
python-version: ${{ matrix.python-version }}
- name: Run pytest
uses: pavelzw/pytest-action@v2
env:
LNBITS_BACKEND_WALLET_CLASS: FakeWallet
PYTHONUNBUFFERED: 1
DEBUG: true
with:
verbose: true
job-summary: true
emoji: false
click-to-expand: true
custom-pytest: poetry run pytest
report-title: 'test (${{ matrix.python-version }})'
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" --generate-notes
pullrequest:
needs: [release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.EXT_GITHUB }}
repository: lnbits/lnbits-extensions
path: './lnbits-extensions'

- name: setup git user
run: |
git config --global user.name "alan"
git config --global user.email "[email protected]"
- name: Create pull request in extensions repo
env:
GH_TOKEN: ${{ secrets.EXT_GITHUB }}
repo_name: '${{ github.event.repository.name }}'
tag: '${{ github.ref_name }}'
branch: 'update-${{ github.event.repository.name }}-${{ github.ref_name }}'
title: '[UPDATE] ${{ github.event.repository.name }} to ${{ github.ref_name }}'
body: 'https://github.com/lnbits/${{ github.event.repository.name }}/releases/${{ github.ref_name }}'
archive: 'https://github.com/lnbits/${{ github.event.repository.name }}/archive/refs/tags/${{ github.ref_name }}.zip'
run: |
cd lnbits-extensions
git checkout -b $branch
# if there is another open PR
git pull origin $branch || echo "branch does not exist"
sh util.sh update_extension $repo_name $tag
git add -A
git commit -am "$title"
git push origin $branch
# check if pr exists before creating it
gh config set pager cat
check=$(gh pr list -H $branch | wc -l)
test $check -ne 0 || gh pr create --title "$title" --body "$body" --repo lnbits/lnbits-extensions
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"semi": false,
"arrowParens": "avoid",
"insertPragma": false,
"printWidth": 80,
"proseWrap": "preserve",
"singleQuote": true,
"trailingComma": "none",
"useTabs": false,
"bracketSameLine": false,
"bracketSpacing": false
}
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Satspot",
"version": "1.0.0",
"short_description": "Money pool games",
"tile": "/satspot/static/image/satspot.png",
"min_lnbits_version": "1.0.0",
Expand Down
1,535 changes: 874 additions & 661 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pytest = "^7.3.2"
mypy = "^1.5.1"
pre-commit = "^3.2.2"
ruff = "^0.3.2"
pytest-md = "^0.2.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
148 changes: 74 additions & 74 deletions static/js/index.js
Original file line number Diff line number Diff line change
@@ -1,144 +1,144 @@
const mapSatspots = (obj) => {
obj._data = _.clone(obj);
const mapSatspots = obj => {
obj._data = _.clone(obj)
obj.closing_date = Quasar.date.formatDate(
new Date(obj.closing_date),
"YYYY-MM-DD HH:mm",
);
return obj;
};
'YYYY-MM-DD HH:mm'
)
return obj
}

window.app = Vue.createApp({
el: "#vue",
el: '#vue',
mixins: [windowMixin],
data() {
return {
satspots: [],
players: {
show: false,
data: [],
data: []
},
satspotsTable: {
columns: [
{ name: "id", align: "left", label: "ID", field: "id" },
{ name: "name", align: "left", label: "Name", field: "name" },
{name: 'id', align: 'left', label: 'ID', field: 'id'},
{name: 'name', align: 'left', label: 'Name', field: 'name'},
{
name: "closing_date",
align: "right",
label: "Closing Date",
field: "closing_date",
name: 'closing_date',
align: 'right',
label: 'Closing Date',
field: 'closing_date'
},
{
name: "buy_in",
align: "left",
label: "buy_in",
field: "buy_in",
name: 'buy_in',
align: 'left',
label: 'buy_in',
field: 'buy_in'
},
{
name: "haircut",
align: "left",
label: "haircut",
field: "haircut",
name: 'haircut',
align: 'left',
label: 'haircut',
field: 'haircut'
},
{
name: "completed",
align: "left",
label: "completed",
field: "completed",
},
name: 'completed',
align: 'left',
label: 'completed',
field: 'completed'
}
],
pagination: {
rowsPerPage: 10,
},
rowsPerPage: 10
}
},
formDialogSatspot: {
show: false,
fixedAmount: true,
data: {
name: "",
name: '',
number_of_players: 2,
buy_in: 1000,
wallet: null,
},
},
};
wallet: null
}
}
}
},
methods: {
exportCSV() {
LNbits.utils.exportCSV(this.satspotsTable.columns, this.satspots);
LNbits.utils.exportCSV(this.satspotsTable.columns, this.satspots)
},
async getSatspotGames() {
await LNbits.api
.request(
"GET",
"/satspot/api/v1/satspot",
this.g.user.wallets[0].adminkey,
'GET',
'/satspot/api/v1/satspot',
this.g.user.wallets[0].adminkey
)
.then((response) => {
.then(response => {
if (response.data != null) {
this.satspots = response.data;
this.satspots = response.data
}
})
.catch((err) => {
LNbits.utils.notifyApiError(err);
});
.catch(err => {
LNbits.utils.notifyApiError(err)
})
},
async openPlayers(players) {
this.players.show = true;
this.players.data = players.split(",");
this.players.show = true
this.players.data = players.split(',')
},
async createGame() {
const date = new Date(this.formDialogSatspot.data.closing_date);
const unixTimestamp = Math.floor(date.getTime() / 1000);
const date = new Date(this.formDialogSatspot.data.closing_date)
const unixTimestamp = Math.floor(date.getTime() / 1000)
const data = {
name: this.formDialogSatspot.data.name,
buy_in: this.formDialogSatspot.data.buy_in,
closing_date: parseInt(unixTimestamp),
haircut: this.formDialogSatspot.data.haircut,
};
haircut: this.formDialogSatspot.data.haircut
}
const wallet = _.findWhere(this.g.user.wallets, {
id: this.formDialogSatspot.data.wallet,
});
id: this.formDialogSatspot.data.wallet
})
try {
const response = await LNbits.api.request(
"POST",
"/satspot/api/v1/satspot",
'POST',
'/satspot/api/v1/satspot',
wallet.adminkey,
data,
);
data
)
if (response.data) {
this.satspots = response.data.map(mapSatspots);
this.formDialogSatspot.show = false;
this.satspots = response.data.map(mapSatspots)
this.formDialogSatspot.show = false
}
} catch (error) {
LNbits.utils.notifyApiError(error);
LNbits.utils.notifyApiError(error)
}
},
deleteSatspot(satpotid) {
const satspot = _.findWhere(this.satspots, { id: satpotid });
const satspot = _.findWhere(this.satspots, {id: satpotid})

LNbits.utils
.confirmDialog("Are you sure you want to delete this satspot?")
.confirmDialog('Are you sure you want to delete this satspot?')
.onOk(() => {
LNbits.api
.request(
"DELETE",
"/satspot/api/v1/satspot/" + satpotid,
_.findWhere(this.g.user.wallets, { id: satspot.wallet }).adminkey,
'DELETE',
'/satspot/api/v1/satspot/' + satpotid,
_.findWhere(this.g.user.wallets, {id: satspot.wallet}).adminkey
)
.then((response) => {
.then(response => {
this.satspots = _.reject(
this.satspots,
(obj) => obj.id === satpotid,
);
obj => obj.id === satpotid
)
})
.catch((err) => {
LNbits.utils.notifyApiError(err);
});
});
},
.catch(err => {
LNbits.utils.notifyApiError(err)
})
})
}
},
async created() {
// CHECK COINFLIP SETTINGS
await this.getSatspotGames();
},
});
await this.getSatspotGames()
}
})
Loading

0 comments on commit b3319a3

Please sign in to comment.