Skip to content

Commit

Permalink
support local build with nektos/act
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Sep 17, 2023
1 parent b918bec commit d4073fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .act-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"act": true
}
10 changes: 10 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# config file for https://github.com/nektos/act

# https://github.com/nektos/act#skipping-jobs
-e .act-event.json

-W .github/workflows/build.yml
-j build
--matrix os:ubuntu-latest
--matrix PYTHON_VERSION:3.11

34 changes: 21 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ jobs:
- name: Git checkout
uses: actions/checkout@v4 #https://github.com/actions/checkout

- name: Configure Fast APT Mirror
uses: vegardit/fast-apt-mirror.sh@v1

- name: Install Chromium Browser
if: env.ACT == 'true' && startsWith(matrix.os, 'ubuntu')
run: |
if ! hash google-chrome &>/dev/null; then
curl -sSfL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb
sudo dpkg -i /tmp/chrome.deb || true
sudo apt-get --no-install-recommends -y --fix-broken install
fi
- uses: actions/setup-python@v4
with:
python-version: "${{ matrix.PYTHON_VERSION }}"
Expand All @@ -80,28 +92,24 @@ jobs:
pdm install -v
- name: Display project metadata
run: |
pdm show
run: pdm show

- name: Security scan
run: |
pdm run scan
run: pdm run scan

- name: Check code style
run: |
pdm run lint
run: pdm run lint

- name: Run unit tests
run: |
pdm run utest
run: pdm run utest

- name: Run integration tests
run: |
set -eux
case "${{ matrix.os }}" in
ubuntu-*)
sudo apt-get install -o Acquire::Retries=3 --no-install-recommends -y xvfb
sudo apt-get install --no-install-recommends -y xvfb
xvfb-run pdm run itest
;;
*) pdm run itest
Expand All @@ -124,7 +132,7 @@ jobs:
- name: "Install: binutils (strip)"
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get --no-install-recommends install -y binutils
run: sudo apt-get install --no-install-recommends -y binutils

- name: "Install: UPX"
if: startsWith(matrix.os, 'windows')
Expand Down Expand Up @@ -160,7 +168,7 @@ jobs:
- name: Upload self-contained executable
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main' && matrix.PUBLISH_RELEASE
if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && !env.ACT }}
with:
name: artifacts-${{ matrix.os }}
path: dist/kleinanzeigen-bot*
Expand All @@ -175,7 +183,7 @@ jobs:
docker run --rm second-hand-friends/kleinanzeigen-bot help
- name: Publish Docker image
if: github.ref == 'refs/heads/main' && matrix.PUBLISH_RELEASE && startsWith(matrix.os, 'ubuntu')
if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && startsWith(matrix.os, 'ubuntu') && !env.ACT }}
run: |
set -eux
Expand All @@ -192,7 +200,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
if: github.ref == 'refs/heads/main'
if: ${{ github.ref_name == 'main' && !github.event.act }}
concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency

steps:
Expand Down
1 change: 1 addition & 0 deletions tests/test_selenium_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@pytest.mark.itest
def test_webdriver_auto_init():
selenium_mixin = SeleniumMixin()
selenium_mixin.browser_config.arguments = ["--no-sandbox"]

browser_info = selenium_mixin.find_compatible_browser()
utils.ensure(browser_info is not None, "Chrome type not auto-detected")
Expand Down

0 comments on commit d4073fb

Please sign in to comment.