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

CI: Update workflows #1506

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cde28f4
expose node version
tooomm Mar 26, 2021
1881aae
another try
tooomm Mar 26, 2021
c725df7
Update tests.yml
tooomm Mar 26, 2021
61e7855
reorder
tooomm Mar 26, 2021
8db1436
add node 16
tooomm Apr 12, 2021
c220b6d
remove quotes
tooomm Apr 12, 2021
6c063ae
postpone v16 to official release as current
tooomm Apr 12, 2021
05fceb9
curl
tooomm Apr 12, 2021
7193985
Update tests.yml
tooomm Apr 12, 2021
973727e
Update tests.yml
tooomm Apr 12, 2021
839fbf9
Update tests.yml
tooomm Apr 12, 2021
7c53722
Update tests.yml
tooomm Apr 12, 2021
cf0ee7d
comment
tooomm Apr 12, 2021
1860162
Update tests.yml
tooomm Apr 12, 2021
e7ec400
names
tooomm Apr 14, 2021
c314b94
Update tests.yml
tooomm Apr 14, 2021
4c3286f
comment docker checks out
tooomm Apr 14, 2021
2575a66
add node 16 to test matrix
tooomm Apr 20, 2021
539fb48
add LTS alias
tooomm Jun 30, 2021
d7ca092
add npm cache
tooomm Jul 5, 2021
ac5b481
Test against current node version
tooomm Jul 5, 2021
fcef544
disable fail-fast
tooomm Jul 19, 2021
63eee84
Update tests.yml
tooomm Oct 24, 2021
1cdbe4a
correct fail-fast
tooomm Oct 24, 2021
3681408
npm ci
tooomm Nov 27, 2021
7bb4cb9
Merge branch 'master' into tooomm-patch-7
tooomm Feb 8, 2022
2012d55
Merge branch 'master' into tooomm-patch-7
tooomm Feb 27, 2022
f768434
fix node
tooomm Feb 27, 2022
bc61bee
some version bumps and adjust alias
tooomm May 16, 2022
d28fb46
Update tests.yml
tooomm May 30, 2022
849fda3
Merge branch 'master' into tooomm-patch-7
tooomm Jun 4, 2022
48fb9cb
Update tests.yml
tooomm Jun 4, 2022
f6bc29d
Merge branch 'master' into tooomm-patch-7
tooomm Jun 20, 2022
ed2901b
test getting node from package.json
tooomm May 1, 2023
1c4613a
Merge branch 'master' into tooomm-patch-7
tooomm May 1, 2023
a130018
updates
tooomm May 1, 2023
a1f9a6b
bump
tooomm Oct 28, 2023
5ae3a90
cleanup
tooomm Oct 28, 2023
187cf54
Merge branch 'master' into tooomm-patch-7
tooomm Oct 28, 2023
c7b32b0
Merge branch 'master' into tooomm-patch-7
tooomm Oct 28, 2023
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
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ updates:
# # Limit the amout of open PR's (default = 5, disabled = 0, security updates are not impacted)
# open-pull-requests-limit: 5
#
# Enable version updates for Docker
#Since we use the lts-alpine image in the Dockerfile this is currently not needed
# # Enable version updates for Docker
#- package-ecosystem: "docker"
# # Look for a `Dockerfile` in the `root` directory
# directory: "/"
Expand Down
84 changes: 51 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Automated tests
name: CI

on:
push:
Expand All @@ -13,76 +13,94 @@ on:
- '**.md'

jobs:
test:
name: Run tests

node:
name: Node.js (${{matrix.node_version_file}})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node_version:
- 16
- 18

runs-on: ubuntu-latest
node_version_file:
- .nvmrc
- package.json

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup
- name: Setup Node.js from ${{matrix.node_version_file}} file
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node_version}}
node-version-file: ${{matrix.node_version_file}}
cache: npm
cache-dependency-path: 'package-lock.json'

- name: Install
run: npm ci
- name: Install modules from package.json
run: npm clean-install --ignore-scripts

- name: Run postinstall scripts
run: npm run postinstall

- name: Test
run: npm test
- name: Run tests
run: npm run test:js


docker:
name: Test docker image

name: Docker
runs-on: ubuntu-latest

continue-on-error: true

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Build
- name: Build image from Dockerfile
run: docker build --tag dr4ft-app .

- name: Run
run: docker run -dp 1337:1337 dr4ft-app
- name: Run container from image
run: docker run --detach --name dr4ft -p 1337:1337 dr4ft-app

# TODO: Extend this and test e.g. creating a game via API
- name: Access dr4ft page
run: wget http://localhost:1337

- name: Show info
- name: Show information
run: |
docker --version
echo
docker ps -a
docker images dr4ft-app
echo
docker ps
echo
echo "Node version (dr4ft-app image)"
docker run dr4ft-app node --version
echo
docker images
docker top dr4ft


lint:
name: Run ESLint

name: ESLint
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup
- name: Setup Node.js from .nvmrc file
uses: actions/setup-node@v4
with:
node-version: 18
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: 'package-lock.json'

- name: Install
run: npm ci --ignore-scripts
- name: Install ESLint
run: npm clean-install eslint --ignore-scripts

- name: Run ESLint
run: npm run lint
run: |
echo "Node version"
node --version
echo "ESLint version"
npx eslint --version
npm run lint
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ RUN adduser -S dr4ftuser
RUN chown dr4ftuser -R .
USER dr4ftuser

# Install the dependencies
RUN npm ci
# Install dependencies
RUN npm clean-install --ignore-scripts

# Run postinstall scripts
RUN npm run postinstall

# Publish the port 1337
EXPOSE 1337
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# dr4ft [![Discord](https://img.shields.io/discord/224178957103136779?label=Discord&logo=discord&logoColor=white&color=7289da)](https://mtgjson.com/discord)

*dr4ft* is a <kbd>NodeJS</kbd> based web-application that simulates draft and sealed format between players and/or bots.
Most of MTG sets are playable thanks to MTGJson support. We follow as much as possible the rules that determine how a real booster is created.
*dr4ft* is a <kbd>Node.js</kbd> based web-application that simulates draft and sealed format between players and/or bots.
Most of MTG sets are playable thanks to MTGJSON support. We follow as much as possible the rules that determine how a real booster is created.

The application provides the following features:

Expand Down Expand Up @@ -64,10 +64,9 @@ It supports all their features, and many more.

### Native

1) Install [Node.js](https://nodejs.org/en/download/) >= 16.0.0. Alternatively, install [nvm](https://github.com/nvm-sh/nvm) and then run `nvm use` in this repo, which will install the correct Node version for this repo as defined in the `.nvmrc` file.
1) Install [Node.js](https://nodejs.org/en/download/) >= 16.0.0<br> Alternatively, install [nvm](https://github.com/nvm-sh/nvm) and run `nvm use` in the project root to install a correct Node version for this repo as defined in the [`.nvmrc`](.nvmrc) file.
2) Run<br>
`$ npm ci`<br>
`$ npm run build`<br>
`$ npm start`
3) Visit [http://localhost:1337](http://localhost:1337)

Expand All @@ -86,17 +85,17 @@ You can also create a Docker image and run the app in a container:

### Start Server

`npm start`
This command start the server
- `npm start`
This command starts the server.

`npm run download_allsets`
This command downloads all sets from MTGJson and integrates them.
- `npm run download_allsets`
This command downloads all sets from [MTGJSON](https://mtgjson.com) and integrates them.

`npm run update_database`
This command downloads integrates all files previously downloaded from MTGJson.
- `npm run update_database`
This command downloads and integrates all files previously downloaded from MTGJSON.

`npm run download_booster_rules`
download and parse booster generation rules from [magic-sealed-data](https://github.com/taw/magic-sealed-data)
- `npm run download_booster_rules`
This command downloads and parses booster generation rules from [taw/magic-sealed-data](https://github.com/taw/magic-sealed-data)

## Development Notes

Expand Down Expand Up @@ -140,6 +139,7 @@ Pull requests are welcome. For major changes, please open an issue first to disc

Please make sure to update tests as appropriate.

<br>
<p align='center'>
<sub><i>The project is unaffiliated with Wizards of the Coast, and is licensed under the MIT license.</i></sub>
</p>
Expand Down
Loading