diff --git a/.github/actions/build-website/action.yml b/.github/actions/build-website/action.yml index ea1539a..e14c383 100644 --- a/.github/actions/build-website/action.yml +++ b/.github/actions/build-website/action.yml @@ -1,20 +1,21 @@ name: 'Build huroutes' description: 'Builds the huroutes website from source' -runs: - using: 'composite' - steps: - - name: Minify the website code - shell: bash - run: | - sudo pip install minify-html==0.15.0 - sudo pip install rjsmin==1.2.3 - sudo pip install rcssmin==1.2.0 - sudo pip install lxml==5.3.0 - python ".github/scripts/optimize-site.py" . +runs: + using: 'composite' + steps: + - name: Set up isolated Python environment + shell: bash + run: | + python -m venv "$RUNNER_TEMP/huroutes-build-venv" + "$RUNNER_TEMP/huroutes-build-venv/bin/python" -m pip install --disable-pip-version-check minify-html==0.15.0 rjsmin==1.2.3 rcssmin==1.2.0 lxml==5.3.0 kml2geojson==5.1.0 + echo "HUROUTES_BUILD_PYTHON=$RUNNER_TEMP/huroutes-build-venv/bin/python" >> "$GITHUB_ENV" + - name: Minify the website code + shell: bash + run: | + "$HUROUTES_BUILD_PYTHON" ".github/scripts/optimize-site.py" . - name: Download curves data - # This step downloads and converts autogenerated curvature data for a map overlay. - # The script supports processing KMZ files provided by kml.roadcurvature.com. "Curve" KMZ format is not supported. - shell: bash - run: | - sudo pip install kml2geojson==5.1.0 - python ".github/scripts/get-curve-map.py" "https://kml.roadcurvature.com/europe/hungary.c_1000.kmz" "map/curves.geo.json" "map/curves-style.json" + # This step downloads and converts autogenerated curvature data for a map overlay. + # The script supports processing KMZ files provided by kml.roadcurvature.com. "Curve" KMZ format is not supported. + shell: bash + run: | + "$HUROUTES_BUILD_PYTHON" ".github/scripts/get-curve-map.py" "https://kml.roadcurvature.com/europe/hungary.c_1000.kmz" "map/curves.geo.json" "map/curves-style.json" diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml index 61f129b..8a23636 100644 --- a/.github/workflows/deploy-pr-preview.yml +++ b/.github/workflows/deploy-pr-preview.yml @@ -14,12 +14,16 @@ jobs: deploy-pr-preview: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build the website - uses: ./.github/actions/build-website + - name: Checkout + uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Build the website + uses: ./.github/actions/build-website - name: Deploy uses: rossjrw/pr-preview-action@v1 with: source-dir: . - umbrella-dir: pr \ No newline at end of file + umbrella-dir: pr diff --git a/.github/workflows/deploy-website-build.yml b/.github/workflows/deploy-website-build.yml index 4f773cf..a945e29 100644 --- a/.github/workflows/deploy-website-build.yml +++ b/.github/workflows/deploy-website-build.yml @@ -14,12 +14,16 @@ jobs: deploy-website: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build the website - uses: ./.github/actions/build-website + - name: Checkout + uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Build the website + uses: ./.github/actions/build-website - name: Deploy uses: JamesIves/github-pages-deploy-action@v4 with: clean-exclude: pr/ - folder: . \ No newline at end of file + folder: . diff --git a/.github/workflows/huroutes-static-tests.yml b/.github/workflows/huroutes-static-tests.yml index b10f414..0d38ae6 100644 --- a/.github/workflows/huroutes-static-tests.yml +++ b/.github/workflows/huroutes-static-tests.yml @@ -16,11 +16,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Ensure the jsonschema lib - run: sudo pip install jsonschema + uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' - name: Run the check - run: python ".github/scripts/validate-database.py" data.json data.schema.json + run: | + python -m venv "$RUNNER_TEMP/huroutes-test-venv" + "$RUNNER_TEMP/huroutes-test-venv/bin/python" -m pip install --disable-pip-version-check jsonschema + "$RUNNER_TEMP/huroutes-test-venv/bin/python" ".github/scripts/validate-database.py" data.json data.schema.json codeql: # Runs CodeQL checks on javascript source code name: Analyze @@ -34,13 +39,13 @@ jobs: matrix: language: [ 'javascript' ] steps: - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - name: Checkout - uses: actions/checkout@v3 - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Checkout + uses: actions/checkout@v6 + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@v4 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4