summaryrefslogtreecommitdiff
path: root/.github/workflows/serenity-js-artifacts.yml
blob: 5585f01c3c3aa10d0cc7fa1e3cfa525a618a036b (plain)
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
104
105
name: Package the js repl as a binary artifact

on: [push]

env:
  SERENITY_SOURCE_DIR: ${{ github.workspace }}

jobs:
  build-and-package:
    runs-on: ${{ matrix.os }}
    if: always() && github.repository == 'SerenityOS/serenity' && github.ref == 'refs/heads/master'
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-22.04]
        package_type: [Linux-x86_64]
        include:
          - os: macos-12
            package_type: macOS-universal2

    concurrency:
      group: ${{ github.workflow }}-${{ matrix.os }}
      cancel-in-progress: true

    steps:
      - name: Checkout SerenityOS/serenity
        uses: actions/checkout@v3

      - name: Install dependencies Ubuntu
        run: |
          sudo apt-get update
          sudo apt-get install -y ninja-build unzip gcc-12 g++-12
        if: ${{ matrix.os == 'ubuntu-22.04' }}

      - name: Install dependencies macOS
        run: |
          brew install bash ninja unzip
        if: ${{ matrix.os == 'macos-12' }}

      - name: Check versions Ubuntu
        run: |
          ninja --version; gcc-12 --version; g++-12 --version
        if: ${{ matrix.os == 'ubuntu-22.04' }}

      - name: Check versions macOS
        run: |
          ninja --version; clang++ --version
        if: ${{ matrix.os == 'macos-12' }}

      - name: Create build directory
        run: |
          mkdir -p Build/TZDB
          mkdir -p Build/UCD
          mkdir -p Build/CLDR

      - name: TimeZoneData cache
        # TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
        uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
        with:
          path: ${{ github.workspace }}/libjs-test262/Build/TZDB
          key: TimeZoneData-${{ hashFiles('Meta/CMake/time_zone_data.cmake') }}

      - name: UnicodeData cache
        # TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
        uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
        with:
          path: ${{ github.workspace }}/libjs-test262/Build/UCD
          key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}

      - name: UnicodeLocale cache
        # TODO: Change the version to the released version when https://github.com/actions/cache/pull/489 (or 571) is merged.
        uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
        with:
          path: ${{ github.workspace }}/libjs-test262/Build/CLDR
          key: UnicodeLocale-${{ hashFiles('Meta/CMake/locale_data.cmake') }}

      - name: Create build directory Ubuntu
        run: |
          cmake -S Meta/Lagom -B Build -G Ninja \
            -DCMAKE_C_COMPILER=gcc-12 \
            -DCMAKE_CXX_COMPILER=g++-12 \
            -DBUILD_LAGOM=ON
        if: ${{ matrix.os == 'ubuntu-22.04' }}

      - name: Create build directory macOS
        run: |
          # Note: We are using Apple Clang to create Universal binary
          cmake -S Meta/Lagom -B Build -G Ninja \
            -DCMAKE_BUILD_TYPE=Release \
            -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
            -DBUILD_LAGOM=ON
        if: ${{ matrix.os == 'macos-12' }}

      - name: Build and package js
        working-directory: Build
        run: |
          ninja js
          cpack

      - name: Upload js package
        uses: actions/upload-artifact@v3
        with:
          name: serenity-js-${{ matrix.package_type }}
          path: Build/serenity-js*.tar.gz
          retention-days: 7